diff options
Diffstat (limited to 'gcc/testsuite/go.test/test/mallocrep.go')
-rw-r--r-- | gcc/testsuite/go.test/test/mallocrep.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/testsuite/go.test/test/mallocrep.go b/gcc/testsuite/go.test/test/mallocrep.go index 762f3754f5f..9f47e52e2b6 100644 --- a/gcc/testsuite/go.test/test/mallocrep.go +++ b/gcc/testsuite/go.test/test/mallocrep.go @@ -18,6 +18,7 @@ var chatty = flag.Bool("v", false, "chatty") var oldsys uint64 func bigger() { + runtime.UpdateMemStats() if st := runtime.MemStats; oldsys < st.Sys { oldsys = st.Sys if *chatty { @@ -31,7 +32,7 @@ func bigger() { } func main() { - runtime.GC() // clean up garbage from init + runtime.GC() // clean up garbage from init runtime.MemProfileRate = 0 // disable profiler runtime.MemStats.Alloc = 0 // ignore stacks flag.Parse() @@ -45,8 +46,10 @@ func main() { panic("fail") } b := runtime.Alloc(uintptr(j)) + runtime.UpdateMemStats() during := runtime.MemStats.Alloc runtime.Free(b) + runtime.UpdateMemStats() if a := runtime.MemStats.Alloc; a != 0 { println("allocated ", j, ": wrong stats: during=", during, " after=", a, " (want 0)") panic("fail") |