gcc/libgo/go/runtime/gc_test.go
Ian Lance Taylor d8f412571f Update Go library to last weekly.
From-SVN: r180552
2011-10-26 23:57:58 +00:00

25 lines
389 B
Go

package runtime_test
import (
"runtime"
"testing"
)
func TestGcSys(t *testing.T) {
for i := 0; i < 1000000; i++ {
workthegc()
}
// Should only be using a few MB.
runtime.UpdateMemStats()
sys := runtime.MemStats.Sys
t.Logf("using %d MB", sys>>20)
if sys > 10e6 {
t.Fatalf("using too much memory: %d MB", sys>>20)
}
}
func workthegc() []byte {
return make([]byte, 1029)
}