This fixes occasional 64-bit failures.
Maybe it will fix the 32-bit failures too,
so re-enable on 32-bit for now.
R=golang-dev, bradfitz, r, dvyukov
CC=golang-dev
https://golang.org/cl/
6218050
)
func TestGcSys(t *testing.T) {
- if runtime.GOARCH != "amd64" {
- // TODO(adg): remove this when precise gc is implemented
- t.Logf("skipping on non-amd64 systems")
- return
- }
memstats := new(runtime.MemStats)
runtime.GC()
runtime.ReadMemStats(memstats)
}
// Should only be using a few MB.
+ // We allocated 100 MB or (if not short) 1 GB.
runtime.ReadMemStats(memstats)
if sys > memstats.Sys {
sys = 0
sys = memstats.Sys - sys
}
t.Logf("used %d extra bytes", sys)
- if sys > 4<<20 {
+ if sys > 16<<20 {
t.Fatalf("using too much memory: %d bytes", sys)
}
}