Re: [go-nuts] Inconsistency in GC behavior depending on runtime.Goexit

2025-04-09 Thread Yaroslav Brustinov
And as Sean pointed out, the reason it is never run is that the object > being cleaned up is still referenced (I didn’t verify this) > > On Apr 3, 2025, at 5:28 PM, Yaroslav Brustinov wrote: > >  > > I was sure the doc means the case when a program exits *too quickly,* > bef

Re: [go-nuts] Inconsistency in GC behavior depending on runtime.Goexit

2025-04-03 Thread Yaroslav Brustinov
t engels wrote: > It states this in the API docs: > > "The cleanup(arg) call is not always guaranteed to run; in particular it > is not guaranteed to run before program exit." > > On Apr 3, 2025, at 10:23 AM, Yaroslav Brustinov > wrote: > > Hello, experts.

[go-nuts] Inconsistency in GC behavior depending on runtime.Goexit

2025-04-03 Thread Yaroslav Brustinov
Hello, experts. Given following code as example: package main import ( "fmt" "io" "runtime" "sync/atomic" "time" ) type S struct { foo int } var released1 atomic.Bool var released2 atomic.Bool func releaseCb(releaseFlag *atomic.Bool) { fmt.Println("release CB") releaseFlag.Store(true) } func