diff options
Diffstat (limited to 'libgo/go/runtime/gc_test.go')
-rw-r--r-- | libgo/go/runtime/gc_test.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/libgo/go/runtime/gc_test.go b/libgo/go/runtime/gc_test.go new file mode 100644 index 00000000000..fad60a36804 --- /dev/null +++ b/libgo/go/runtime/gc_test.go @@ -0,0 +1,24 @@ +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) +} |