aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/export_test.go
diff options
context:
space:
mode:
authorMichael Anthony Knyszek <mknyszek@google.com>2018-10-15 23:00:58 +0000
committerMichael Knyszek <mknyszek@google.com>2018-10-30 15:28:07 +0000
commit61d40c8abc82fd845b5e4340bdf0495de0de7ecd (patch)
tree5d35ea74c909d5a01b7aca3ceb21dd54dd0bbcae /src/runtime/export_test.go
parent78bb91cbd34a8f2f3784ba5df94c0e56c44fc751 (diff)
downloadgo-61d40c8abc82fd845b5e4340bdf0495de0de7ecd.tar.xz
runtime: extend ReadMemStatsSlow to re-compute HeapReleased
This change extends the test function ReadMemStatsSlow to re-compute the HeapReleased statistic such that it is checked in testing to be consistent with the bookkeeping done in the runtime. Change-Id: I49f5c2620f5731edea8e9f768744cf997dcd7c22 Reviewed-on: https://go-review.googlesource.com/c/142397 Run-TryBot: Michael Knyszek <mknyszek@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com>
Diffstat (limited to 'src/runtime/export_test.go')
-rw-r--r--src/runtime/export_test.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/runtime/export_test.go b/src/runtime/export_test.go
index 89f887b765..56dd95e469 100644
--- a/src/runtime/export_test.go
+++ b/src/runtime/export_test.go
@@ -297,6 +297,7 @@ func ReadMemStatsSlow() (base, slow MemStats) {
slow.TotalAlloc = 0
slow.Mallocs = 0
slow.Frees = 0
+ slow.HeapReleased = 0
var bySize [_NumSizeClasses]struct {
Mallocs, Frees uint64
}
@@ -336,6 +337,10 @@ func ReadMemStatsSlow() (base, slow MemStats) {
slow.BySize[i].Frees = bySize[i].Frees
}
+ mheap_.scav.treap.walkTreap(func(tn *treapNode) {
+ slow.HeapReleased += uint64(tn.spanKey.released())
+ })
+
getg().m.mallocing--
})