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 <alexander.d.mi...@gmail.com> wrote: > > I have this helper func to print memory usage (detect a memory leak?) > > > func PrintMemUsage() { > var m runtime.MemStats > runtime.ReadMemStats(&m) > // For info on each, see: https://golang.org/pkg/runtime/#MemStats > fmt.Printf("Alloc = %v MiB", bToMb(m.Alloc)) > fmt.Printf("\tTotalAlloc = %v MiB", bToMb(m.TotalAlloc)) > fmt.Printf("\tSys = %v MiB", bToMb(m.Sys)) > fmt.Printf("\tNumGC = %v\n", m.NumGC) > } > > I am seeing output like this: > Alloc = 2481 MiB TotalAlloc = 24038 MiB Sys = 2752 MiB NumGC = 114 > > what is the difference between Alloc and TotalAlloc .. ? > thx > > -- > You received this message because you are subscribed to a topic in the Google > Groups "golang-nuts" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/golang-nuts/zLxLN03h6LQ/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > golang-nuts+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/20f0b65f-a420-4ab1-9a44-57e7414c7bd5n%40googlegroups.com. -- Alexander D. Mills New cell phone # (415)730-1805 linkedin.com/in/alexanderdmills -- 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 on the web visit https://groups.google.com/d/msgid/golang-nuts/CA%2BKyZp40b7waZymt%3DVw6Wd%2BVzUOG9RCDckzoYb7OLNOKPnWAEg%40mail.gmail.com.