]> Cypherpunks repositories - gostls13.git/commitdiff
test: Run garbage collector before testing malloc numbers.
authorIan Lance Taylor <iant@golang.org>
Fri, 10 Sep 2010 22:54:16 +0000 (15:54 -0700)
committerIan Lance Taylor <iant@golang.org>
Fri, 10 Sep 2010 22:54:16 +0000 (15:54 -0700)
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

test/mallocrep.go

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