@@ -32,7 +32,6 @@ type mstats struct {
32
32
//
33
33
// Like MemStats, heap_sys and heap_inuse do not count memory
34
34
// in manually-managed spans.
35
- heap_alloc uint64 // bytes allocated and not yet freed (same as alloc above)
36
35
heap_sys sysMemStat // virtual address space obtained from system for GC'd heap
37
36
heap_inuse uint64 // bytes in mSpanInUse spans
38
37
heap_released uint64 // bytes released to the os
@@ -112,11 +111,10 @@ type mstats struct {
112
111
113
112
// heap_live is the number of bytes considered live by the GC.
114
113
// That is: retained by the most recent GC plus allocated
115
- // since then. heap_live <= heap_alloc, since heap_alloc
116
- // includes unmarked objects that have not yet been swept (and
117
- // hence goes up as we allocate and down as we sweep) while
118
- // heap_live excludes these objects (and hence only goes up
119
- // between GCs).
114
+ // since then. heap_live <= alloc, since alloc includes unmarked
115
+ // objects that have not yet been swept (and hence goes up as we
116
+ // allocate and down as we sweep) while heap_live excludes these
117
+ // objects (and hence only goes up between GCs).
120
118
//
121
119
// This is updated atomically without locking. To reduce
122
120
// contention, this is updated only when obtaining a span from
@@ -458,7 +456,7 @@ func readmemstats_m(stats *MemStats) {
458
456
stats .Sys = memstats .sys
459
457
stats .Mallocs = memstats .nmalloc
460
458
stats .Frees = memstats .nfree
461
- stats .HeapAlloc = memstats .heap_alloc
459
+ stats .HeapAlloc = memstats .alloc
462
460
stats .HeapSys = memstats .heap_sys .load ()
463
461
// By definition, HeapIdle is memory that was mapped
464
462
// for the heap but is not currently used to hold heap
@@ -639,7 +637,6 @@ func updatememstats() {
639
637
// Calculate derived stats.
640
638
memstats .total_alloc = totalAlloc
641
639
memstats .alloc = totalAlloc - totalFree
642
- memstats .heap_alloc = memstats .alloc
643
640
memstats .heap_objects = memstats .nmalloc - memstats .nfree
644
641
}
645
642
0 commit comments