diff --git a/test/heapsampling.go b/test/heapsampling.go index ed9208c1f42..c00b866680a 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)),