summaryrefslogtreecommitdiff
path: root/test/gc2.go
diff options
context:
space:
mode:
authorR?my Oudompheng <oudomphe@phare.normalesup.org>2012-02-06 19:16:26 +0100
committerR?my Oudompheng <oudomphe@phare.normalesup.org>2012-02-06 19:16:26 +0100
commit71f9a05e783532e348b78ac6696a9bd2b64c90d6 (patch)
tree21b5b46e4adf5b7fd3e5753ccb3dcddbd20ede67 /test/gc2.go
parenta899195ae7479be02c2d4212f316698e123b471c (diff)
downloadgo-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/gc2.go')
-rw-r--r--test/gc2.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/test/gc2.go b/test/gc2.go
index c54d807df..772f9810d 100644
--- a/test/gc2.go
+++ b/test/gc2.go
@@ -19,7 +19,9 @@ import (
func main() {
const N = 10000
- st := runtime.MemStats
+ st := new(runtime.MemStats)
+ memstats := new(runtime.MemStats)
+ runtime.ReadMemStats(st)
for i := 0; i < N; i++ {
c := make(chan int, 10)
_ = c
@@ -33,8 +35,8 @@ func main() {
}
}
- runtime.UpdateMemStats()
- obj := runtime.MemStats.HeapObjects - st.HeapObjects
+ runtime.ReadMemStats(memstats)
+ obj := memstats.HeapObjects - st.HeapObjects
if obj > N/5 {
fmt.Println("too many objects left:", obj)
os.Exit(1)