Roger.  And thank you Ian.

On Tuesday, January 21, 2025 at 8:19:53 PM UTC-8 Ian Lance Taylor wrote:

> On Tue, Jan 21, 2025 at 6:10 PM John <johns...@gmail.com> wrote:
> >
> > Curious if the new runtime.Cleanup() would allow auto sync.Pool.Put() 
> for a variable. I'm not sure from the documentation if this would work or 
> would cause some type of issue (the variable was on its way to collection 
> and then gets put in a pool. I assume it would stop collection?). The 
> guarantees for running it seem to be better than Finalizer for this kind of 
> thing (its working for file closures, so I'm guessing this will eventually 
> happen), but still not sure how much better.
>
> It should be fine to use runtime.AddCleanup to add something to a
> sync.Pool. That said, remember that runtime.AddCleanup is not called
> with the pointer that is being freed. It is called on a different
> pointer, that is presumably associated in some way.
>
> Ian
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/golang-nuts/da6826a7-ac75-4fcd-ac13-853108b4c646n%40googlegroups.com.

Reply via email to