diff options
author | R?my Oudompheng <oudomphe@phare.normalesup.org> | 2012-02-06 19:16:26 +0100 |
---|---|---|
committer | R?my Oudompheng <oudomphe@phare.normalesup.org> | 2012-02-06 19:16:26 +0100 |
commit | 71f9a05e783532e348b78ac6696a9bd2b64c90d6 (patch) | |
tree | 21b5b46e4adf5b7fd3e5753ccb3dcddbd20ede67 /test/closure.go | |
parent | a899195ae7479be02c2d4212f316698e123b471c (diff) | |
download | go-71f9a05e783532e348b78ac6696a9bd2b64c90d6.tar.gz |
runtime: delete UpdateMemStats, replace with ReadMemStats(&stats).
Unexports runtime.MemStats and rename MemStatsType to MemStats.
The new accessor requires passing a pointer to a user-allocated
MemStats structure.
Fixes issue 2572.
R=bradfitz, rsc, bradfitz, gustavo
CC=golang-dev, remy
http://codereview.appspot.com/5616072
Diffstat (limited to 'test/closure.go')
-rw-r--r-- | test/closure.go | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/test/closure.go b/test/closure.go index 97da1dd23..c2248d68e 100644 --- a/test/closure.go +++ b/test/closure.go @@ -92,8 +92,9 @@ func main() { go h() check([]int{100, 200, 101, 201, 500, 101, 201, 500}) - runtime.UpdateMemStats() - n0 := runtime.MemStats.Mallocs + memstats := new(runtime.MemStats) + runtime.ReadMemStats(memstats) + n0 := memstats.Mallocs x, y := newfunc(), newfunc() if x(1) != 1 || y(2) != 2 { @@ -101,8 +102,8 @@ func main() { fail = true } - runtime.UpdateMemStats() - if n0 != runtime.MemStats.Mallocs { + runtime.ReadMemStats(memstats) + if n0 != memstats.Mallocs { println("newfunc allocated unexpectedly") fail = true } @@ -110,7 +111,7 @@ func main() { ff(1) if fail { - panic("fail") + panic("fail") } } |