]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: improve MemStats comments
authorAustin Clements <austin@google.com>
Mon, 30 Mar 2015 20:59:09 +0000 (16:59 -0400)
committerAustin Clements <austin@google.com>
Thu, 2 Apr 2015 15:28:50 +0000 (15:28 +0000)
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 <rlh@golang.org>
src/runtime/mstats.go

index 88cf42fe415d8eda1311046c05113f57e2eb90b0..d2e89510c1337e86a8aee4098dd5224d6a654f4c 100644 (file)
@@ -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