aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/mstats.go
diff options
context:
space:
mode:
authorMichael Anthony Knyszek <mknyszek@google.com>2020-08-03 19:31:23 +0000
committerMichael Knyszek <mknyszek@google.com>2020-10-26 18:20:05 +0000
commitae585ee52c2437bfd0e955ad6fc8911bf292f51d (patch)
treeffa9f204136350f0e6aab6fffc24ecd208de50b2 /src/runtime/mstats.go
parentc5dea8f38726572ddc161e5d169a453639edb7b1 (diff)
downloadgo-ae585ee52c2437bfd0e955ad6fc8911bf292f51d.tar.gz
go-ae585ee52c2437bfd0e955ad6fc8911bf292f51d.zip
runtime: remove memstats.heap_alloc
memstats.heap_alloc is 100% a duplicate and unnecessary copy of memstats.alloc which exists because MemStats used to be populated from memstats via a memmove. Change-Id: I995489f61be39786e573b8494a8ab6d4ea8bed9c Reviewed-on: https://go-review.googlesource.com/c/go/+/246975 Run-TryBot: Michael Knyszek <mknyszek@google.com> TryBot-Result: Go Bot <gobot@golang.org> Trust: Michael Knyszek <mknyszek@google.com> Reviewed-by: Michael Pratt <mpratt@google.com>
Diffstat (limited to 'src/runtime/mstats.go')
-rw-r--r--src/runtime/mstats.go13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/runtime/mstats.go b/src/runtime/mstats.go
index 43f74273f7..a6e38d1c1b 100644
--- a/src/runtime/mstats.go
+++ b/src/runtime/mstats.go
@@ -32,7 +32,6 @@ type mstats struct {
//
// Like MemStats, heap_sys and heap_inuse do not count memory
// in manually-managed spans.
- heap_alloc uint64 // bytes allocated and not yet freed (same as alloc above)
heap_sys sysMemStat // virtual address space obtained from system for GC'd heap
heap_inuse uint64 // bytes in mSpanInUse spans
heap_released uint64 // bytes released to the os
@@ -112,11 +111,10 @@ type mstats struct {
// heap_live is the number of bytes considered live by the GC.
// That is: retained by the most recent GC plus allocated
- // since then. heap_live <= heap_alloc, since heap_alloc
- // includes unmarked objects that have not yet been swept (and
- // hence goes up as we allocate and down as we sweep) while
- // heap_live excludes these objects (and hence only goes up
- // between GCs).
+ // since then. heap_live <= alloc, since alloc includes unmarked
+ // objects that have not yet been swept (and hence goes up as we
+ // allocate and down as we sweep) while heap_live excludes these
+ // objects (and hence only goes up between GCs).
//
// This is updated atomically without locking. To reduce
// contention, this is updated only when obtaining a span from
@@ -458,7 +456,7 @@ func readmemstats_m(stats *MemStats) {
stats.Sys = memstats.sys
stats.Mallocs = memstats.nmalloc
stats.Frees = memstats.nfree
- stats.HeapAlloc = memstats.heap_alloc
+ stats.HeapAlloc = memstats.alloc
stats.HeapSys = memstats.heap_sys.load()
// By definition, HeapIdle is memory that was mapped
// for the heap but is not currently used to hold heap
@@ -639,7 +637,6 @@ func updatememstats() {
// Calculate derived stats.
memstats.total_alloc = totalAlloc
memstats.alloc = totalAlloc - totalFree
- memstats.heap_alloc = memstats.alloc
memstats.heap_objects = memstats.nmalloc - memstats.nfree
}