Re: [go-nuts] alloc vs totalalloc in memory

2020-09-12 Thread Wojciech S. Czarnecki
Dnia 2020-09-11, o godz. 17:13:22 Alexander Mills napisał(a): > Well why does TotalAlloc keep climbing up (increasing) in my program, | CUMULATIVE: increasing or increased in quantity, degree, or force by successive additions. | It means that every allocation made _adds_ to an ever

Re: [go-nuts] alloc vs totalalloc in memory

2020-09-11 Thread Robert Engels
Because memory is reclaimed - the alloc is the “live” heap. TotalAlloc is a cumulative counter of byte allocated - bytes freed do not affect the counter. > On Sep 11, 2020, at 7:14 PM, Alexander Mills > wrote: > >  > Well why does TotalAlloc keep climbing up (increasing) in my program, but

Re: [go-nuts] alloc vs totalalloc in memory

2020-09-11 Thread Ian Lance Taylor
On Fri, Sep 11, 2020 at 5:01 PM Alex Mills wrote: > > The explanations I find online arent very clear to me :( Well, OK, but I don't know what I can say other than to repeat the information from that link. Alloc is bytes of allocated heap objects. TotalAlloc is cumulative bytes allocated for

Re: [go-nuts] alloc vs totalalloc in memory

2020-09-11 Thread Alex Mills
The explanations I find online arent very clear to me :( On Thursday, September 10, 2020 at 6:40:34 PM UTC-7 Ian Lance Taylor wrote: > On Thu, Sep 10, 2020 at 4:39 PM Alexander Mills > wrote: > > > > I have this helper func to print memory usage (detect a memory leak?) > > > > > > func

Re: [go-nuts] alloc vs totalalloc in memory

2020-09-10 Thread Ian Lance Taylor
On Thu, Sep 10, 2020 at 4:39 PM Alexander Mills wrote: > > I have this helper func to print memory usage (detect a memory leak?) > > > func PrintMemUsage() { > var m runtime.MemStats > runtime.ReadMemStats() > // For info on each, see: https://golang.org/pkg/runtime/#MemStats > fmt.Printf("Alloc

Re: [go-nuts] alloc vs totalalloc in memory

2020-09-10 Thread Alexander Mills
I stole the memory code from here: https://golangcode.com/print-the-current-memory-usage/ On Thu, Sep 10, 2020 at 4:39 PM Alexander Mills wrote: > > I have this helper func to print memory usage (detect a memory leak?) > > > func PrintMemUsage() { > var m runtime.MemStats >

[go-nuts] alloc vs totalalloc in memory

2020-09-10 Thread Alexander Mills
I have this helper func to print memory usage (detect a memory leak?) func PrintMemUsage() { var m runtime.MemStats runtime.ReadMemStats() // For info on each, see: https://golang.org/pkg/runtime/#MemStats fmt.Printf("Alloc = %v MiB", bToMb(m.Alloc)) fmt.Printf("\tTotalAlloc = %v MiB",