8 func TestGcSys(t *testing.T) {
10 runtime.UpdateMemStats()
11 sys := runtime.MemStats.Sys
13 for i := 0; i < 1000000; i++ {
17 // Should only be using a few MB.
18 runtime.UpdateMemStats()
19 if sys > runtime.MemStats.Sys {
22 sys = runtime.MemStats.Sys - sys
24 t.Logf("used %d extra bytes", sys)
26 t.Fatalf("using too much memory: %d bytes", sys)
30 func workthegc() []byte {
31 return make([]byte, 1029)