From: Dmitriy Vyukov Date: Mon, 2 Jul 2012 16:55:08 +0000 (+0400) Subject: reflect: set GOMAXPROCS=1 in the malloc test X-Git-Tag: go1.1rc2~2844 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=21de1ab359f198fff172f5e2bbaa29ab955a4688;p=gostls13.git reflect: set GOMAXPROCS=1 in the malloc test Occasionally I see: --- FAIL: TestAllocations-15 (0.00 seconds) all_test.go:1575: 6 mallocs after 100 iterations Tested: $ go test -cpu=1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20 reflect R=golang-dev, dsymonds, r CC=golang-dev https://golang.org/cl/6354063 --- diff --git a/src/pkg/reflect/all_test.go b/src/pkg/reflect/all_test.go index e331405635..3b6fd5e585 100644 --- a/src/pkg/reflect/all_test.go +++ b/src/pkg/reflect/all_test.go @@ -1569,9 +1569,10 @@ func noAlloc(t *testing.T, n int, f func(int)) { } // A few allocs may happen in the testing package when GOMAXPROCS > 1, so don't // require zero mallocs. + // A new thread, one of which will be created if GOMAXPROCS>1, does 6 allocations. runtime.ReadMemStats(memstats) mallocs := memstats.Mallocs - oldmallocs - if mallocs > 5 { + if mallocs > 10 { t.Fatalf("%d mallocs after %d iterations", mallocs, n) } }