From: Austin Clements Date: Mon, 30 Mar 2015 20:59:09 +0000 (-0400) Subject: runtime: improve MemStats comments X-Git-Tag: go1.5beta1~1345 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=6134caf1f965045bcc009c0bdb26031ce5583892;p=gostls13.git runtime: improve MemStats comments This tries to clarify that Alloc and HeapAlloc are tied to how much freeing has been done by the sweeper. Change-Id: Id8320074bd75de791f39ec01bac99afe28052d02 Reviewed-on: https://go-review.googlesource.com/8354 Reviewed-by: Rick Hudson --- diff --git a/src/runtime/mstats.go b/src/runtime/mstats.go index 88cf42fe41..d2e89510c1 100644 --- a/src/runtime/mstats.go +++ b/src/runtime/mstats.go @@ -12,7 +12,7 @@ import "unsafe" // Shared with Go: if you edit this structure, also edit type MemStats in mem.go. type mstats struct { // General statistics. - alloc uint64 // bytes allocated and still in use + alloc uint64 // bytes allocated and not yet freed total_alloc uint64 // bytes allocated (even if freed) sys uint64 // bytes obtained from system (should be sum of xxx_sys below, no locking, approximate) nlookup uint64 // number of pointer lookups @@ -21,7 +21,7 @@ type mstats struct { // Statistics about malloc heap. // protected by mheap.lock - heap_alloc uint64 // bytes allocated and still in use + heap_alloc uint64 // bytes allocated and not yet freed (same as alloc above) heap_sys uint64 // bytes obtained from system heap_idle uint64 // bytes in idle spans heap_inuse uint64 // bytes in non-idle spans @@ -67,7 +67,7 @@ var memstats mstats // A MemStats records statistics about the memory allocator. type MemStats struct { // General statistics. - Alloc uint64 // bytes allocated and still in use + Alloc uint64 // bytes allocated and not yet freed TotalAlloc uint64 // bytes allocated (even if freed) Sys uint64 // bytes obtained from system (sum of XxxSys below) Lookups uint64 // number of pointer lookups @@ -75,7 +75,7 @@ type MemStats struct { Frees uint64 // number of frees // Main allocation heap statistics. - HeapAlloc uint64 // bytes allocated and still in use + HeapAlloc uint64 // bytes allocated and not yet freed (same as Alloc above) HeapSys uint64 // bytes obtained from system HeapIdle uint64 // bytes in idle spans HeapInuse uint64 // bytes in non-idle span