Re: [go-nuts] Re: go routines not being deallocated

2021-04-18 Thread 'Keith Randall' via golang-nuts
This might be https://github.com/golang/go/issues/34457 (at least, Brian's repro). When a goroutine finishes, we deallocate its stack, and that deallocation will eventually be given back to the OS. The Goroutine descriptor, however, will live forever. We'll reuse it for new goroutines, but it

Re: [go-nuts] Re: go routines not being deallocated

2021-04-18 Thread Brian Candler
This is memory allocated as reported by go itself, not by the OS. -- 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

Re: [go-nuts] Re: go routines not being deallocated

2021-04-18 Thread Ian B
Just to note, from a Perl background (learning Go atm so this may not apply, just trying to indicate it may be "normal"), I think this isn't necessarily unusual for a process to not free up memory, and it's an OS limitation (again I may be barking up the wrong tree). Elsewhere (i.e not Go), I've

[go-nuts] Re: go routines not being deallocated

2021-04-18 Thread Trig
>From further research (and anybody correct me if this is wrong), when the GC does collect memory the profile shrinks, but *no memory is returned to the system*. Any future allocations will try to use memory from the pool of previously collected objects before asking the system for more. This

[go-nuts] Re: go routines not being deallocated

2021-04-18 Thread Trig
Also, I don't think it's the Stack. If you replace Alloc with HeapAlloc... it's all there. On Sunday, April 18, 2021 at 12:33:20 PM UTC-5 Trig wrote: > Correct... the example using time.Sleep didn't run on the playground. The > original post I made, I provided the link with just a goroutine

[go-nuts] Re: go routines not being deallocated

2021-04-18 Thread Trig
Correct... the example using time.Sleep didn't run on the playground. The original post I made, I provided the link with just a goroutine with an empty function. At least you were able to reproduce what I'm inquiring about. I'll look further into this, but surely unused and finished

[go-nuts] Re: go routines not being deallocated

2021-04-18 Thread Brian Candler
What do you mean by "It won't work on the playground"? It runs for me. Are you saying you get different results when running locally? If so, what version of go are you running locally, on what platform, and what do you see? Or are you saying the problem is really with something like this?

[go-nuts] Re: go routines not being deallocated

2021-04-17 Thread Trig
Sorry, for clarification... the above should be, if you 'put something like time.Sleep(time.Second * 1) *in the go routine*...' On Sunday, April 18, 2021 at 12:32:39 AM UTC-5 Trig wrote: > Can somebody tell me why this is? It won't work on the playground; > however, put something like