diff --git a/src/runtime/traceallocfree.go b/src/runtime/traceallocfree.go index 67c6f40926ff1..e6a2a79c691bb 100644 --- a/src/runtime/traceallocfree.go +++ b/src/runtime/traceallocfree.go @@ -49,11 +49,6 @@ func traceSnapshotMemory(gen uintptr) { throw("traceSnapshotMemory: tracing is not enabled") } - // Write out all the goroutine stacks. - forEachGRace(func(gp *g) { - trace.GoroutineStackExists(gp.stack.lo, gp.stack.hi-gp.stack.lo) - }) - // Write out all the heap spans and heap objects. for _, s := range mheap_.allspans { if s.state.get() == mSpanDead { @@ -77,6 +72,11 @@ func traceSnapshotMemory(gen uintptr) { abits.advance() } } + + // Write out all the goroutine stacks. + forEachGRace(func(gp *g) { + trace.GoroutineStackExists(gp.stack.lo, gp.stack.hi-gp.stack.lo) + }) traceRelease(trace) }