mirror of
https://github.com/golang/go.git
synced 2025-05-16 12:54:37 +00:00
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>
This commit is contained in:
parent
78bb91cbd3
commit
61d40c8abc
@ -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--
|
||||
})
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user