Commit 61d40c8a authored by Michael Anthony Knyszek's avatar Michael Anthony Knyszek Committed by Michael Knyszek

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: 's avatarAustin Clements <austin@google.com>
parent 78bb91cb
...@@ -297,6 +297,7 @@ func ReadMemStatsSlow() (base, slow MemStats) { ...@@ -297,6 +297,7 @@ func ReadMemStatsSlow() (base, slow MemStats) {
slow.TotalAlloc = 0 slow.TotalAlloc = 0
slow.Mallocs = 0 slow.Mallocs = 0
slow.Frees = 0 slow.Frees = 0
slow.HeapReleased = 0
var bySize [_NumSizeClasses]struct { var bySize [_NumSizeClasses]struct {
Mallocs, Frees uint64 Mallocs, Frees uint64
} }
...@@ -336,6 +337,10 @@ func ReadMemStatsSlow() (base, slow MemStats) { ...@@ -336,6 +337,10 @@ func ReadMemStatsSlow() (base, slow MemStats) {
slow.BySize[i].Frees = bySize[i].Frees slow.BySize[i].Frees = bySize[i].Frees
} }
mheap_.scav.treap.walkTreap(func(tn *treapNode) {
slow.HeapReleased += uint64(tn.spanKey.released())
})
getg().m.mallocing-- getg().m.mallocing--
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment