1
0
mirror of https://github.com/golang/go synced 2024-11-25 03:57:56 -07:00

test: Run garbage collector before testing malloc numbers.

The gccgo library generates some garbage in the init routines
because it handles interfaces slightly differently.  Since the
test sets MemStats.Alloc to 0, the first time the garbage
collector runs it goes negative and the test fails.

R=rsc, r2
CC=golang-dev
https://golang.org/cl/2110044
This commit is contained in:
Ian Lance Taylor 2010-09-10 15:54:16 -07:00
parent 8e985dcda6
commit 9d93d57465

View File

@ -31,6 +31,7 @@ func bigger() {
} }
func main() { func main() {
runtime.GC() // clean up garbage from init
runtime.MemProfileRate = 0 // disable profiler runtime.MemProfileRate = 0 // disable profiler
runtime.MemStats.Alloc = 0 // ignore stacks runtime.MemStats.Alloc = 0 // ignore stacks
flag.Parse() flag.Parse()