aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/mheap.go
diff options
context:
space:
mode:
authorMichael Anthony Knyszek <mknyszek@google.com>2020-08-03 19:27:59 +0000
committerMichael Knyszek <mknyszek@google.com>2020-10-26 18:10:12 +0000
commitc5dea8f38726572ddc161e5d169a453639edb7b1 (patch)
tree68fc5289cf9e1288306d37691ccacb2cac60ef15 /src/runtime/mheap.go
parentad863ba32a2ede207d708fa15897e9de1d14dd87 (diff)
downloadgo-c5dea8f38726572ddc161e5d169a453639edb7b1.tar.gz
go-c5dea8f38726572ddc161e5d169a453639edb7b1.zip
runtime: remove memstats.heap_idle
This statistic is updated in many places but for MemStats may be computed from existing statistics. Specifically by definition heap_idle = heap_sys - heap_inuse since heap_sys is all memory allocated from the OS for use in the heap minus memory used for non-heap purposes. heap_idle is almost the same (since it explicitly includes memory that *could* be used for non-heap purposes) but also doesn't include memory that's actually used to hold heap objects. Although it has some utility as a sanity check, it complicates accounting and we want fewer, orthogonal statistics for upcoming metrics changes, so just drop it. Change-Id: I40af54a38e335f43249f6e218f35088bfd4380d1 Reviewed-on: https://go-review.googlesource.com/c/go/+/246974 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/mheap.go')
-rw-r--r--src/runtime/mheap.go3
1 files changed, 0 insertions, 3 deletions
diff --git a/src/runtime/mheap.go b/src/runtime/mheap.go
index 1624a04b9d..87d2fd495b 100644
--- a/src/runtime/mheap.go
+++ b/src/runtime/mheap.go
@@ -1239,7 +1239,6 @@ HaveSpan:
// Manually managed memory doesn't count toward heap_sys.
memstats.heap_sys.add(-int64(nbytes))
}
- atomic.Xadd64(&memstats.heap_idle, -int64(nbytes))
// Publish the span in various locations.
@@ -1317,7 +1316,6 @@ func (h *mheap) grow(npage uintptr) bool {
// size which is always > physPageSize, so its safe to
// just add directly to heap_released.
atomic.Xadd64(&memstats.heap_released, int64(asize))
- atomic.Xadd64(&memstats.heap_idle, int64(asize))
// Recalculate nBase.
// We know this won't overflow, because sysAlloc returned
@@ -1417,7 +1415,6 @@ func (h *mheap) freeSpanLocked(s *mspan, typ spanAllocType) {
// Manually managed memory doesn't count toward heap_sys, so add it back.
memstats.heap_sys.add(int64(nbytes))
}
- atomic.Xadd64(&memstats.heap_idle, int64(nbytes))
// Mark the space as free.
h.pages.free(s.base(), s.npages)