Commit a5331766 authored by Russ Cox's avatar Russ Cox

strconv: run garbage collection before counting allocations in test

My theory is that the call to f() allocates, which triggers
a garbage collection, which itself may do some allocation,
which is being counted.  Running a garbage collection
before starting the test should avoid this problem.

Fixes #2894 (I hope).

R=golang-dev, bradfitz, nigeltao
CC=golang-dev
https://golang.org/cl/5685046
parent 9c9b96f0
......@@ -127,6 +127,7 @@ func TestUitoa(t *testing.T) {
}
func numAllocations(f func()) int {
runtime.GC()
memstats := new(runtime.MemStats)
runtime.ReadMemStats(memstats)
n0 := memstats.Mallocs
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment