runtime: add per-M caches for MemStats
Avoid touching centralized state during
memory manager opreations.
R=rsc
CC=golang-dev
https://golang.org/cl/4766042
diff --git a/test/mallocrep.go b/test/mallocrep.go
index 762f375..43233b7 100644
--- a/test/mallocrep.go
+++ b/test/mallocrep.go
@@ -47,6 +47,7 @@
b := runtime.Alloc(uintptr(j))
during := runtime.MemStats.Alloc
runtime.Free(b)
+ runtime.GC()
if a := runtime.MemStats.Alloc; a != 0 {
println("allocated ", j, ": wrong stats: during=", during, " after=", a, " (want 0)")
panic("fail")