]> Cypherpunks repositories - gostls13.git/commit
test: force heap profile update in heapsampling.go test
authorAustin Clements <austin@google.com>
Thu, 12 Nov 2015 16:30:26 +0000 (11:30 -0500)
committerBrad Fitzpatrick <bradfitz@golang.org>
Thu, 12 Nov 2015 16:58:52 +0000 (16:58 +0000)
commitb5a0c67fcc2f87b5e2fd04e023f9a0b2f3d759da
tree2749a0adb1117037a41bba16f01e08e9ba43e271
parentd54c35675c1f4d4ca9b5a6de568e977c513f364a
test: force heap profile update in heapsampling.go test

The heapsampling.go test occasionally fails on some architectures
because it finds zero heap samples in main.alloc. This happens because
the byte and object counts are only updated at a GC. Hence, if a GC
happens part way through allocInterleaved, but then doesn't happen
after we start calling main.alloc, checkAllocations will see buckets
for the lines in main.alloc (which are created eagerly), but the
object and byte counts will be zero.

Fix this by forcing a GC to update the profile before we collect it.

Fixes #13098.

Change-Id: Ia7a9918eea6399307f10499dd7abefd4f6d13cf6
Reviewed-on: https://go-review.googlesource.com/16846
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
test/heapsampling.go