From: Austin Clements Date: Thu, 12 Nov 2015 17:24:36 +0000 (-0500) Subject: test: really force heap profile update in heapsampling.go X-Git-Tag: go1.6beta1~502 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=a9ca2137aa3ebcf9cf094b20cf30cf50ba577892;p=gostls13.git test: really force heap profile update in heapsampling.go The heap profile is only guaranteed to be up-to-date after two GC cycles, so force two GCs instead of just one. Updates #13098. Change-Id: I4fb9287b698f4a3b90b8af9fc6a2efb3b082bfe5 Reviewed-on: https://go-review.googlesource.com/16848 Reviewed-by: Dmitry Vyukov --- diff --git a/test/heapsampling.go b/test/heapsampling.go index ed9208c1f4..c00b866680 100644 --- a/test/heapsampling.go +++ b/test/heapsampling.go @@ -92,6 +92,9 @@ func checkValue(fname string, ln int, name string, want, got int64) { func getMemProfileRecords() []runtime.MemProfileRecord { // Force the runtime to update the object and byte counts. + // This can take up to two GC cycles to get a complete + // snapshot of the current point in time. + runtime.GC() runtime.GC() // Find out how many records there are (MemProfile(nil, true)),