Commit 573cfe95 authored by Keith Randall's avatar Keith Randall

runtime: heapdump - make sure spans are swept before dumping.

LGTM=rsc
R=golang-codereviews, adonovan, rsc
CC=golang-codereviews
https://golang.org/cl/90440043
parent 1bf690c1
...@@ -567,7 +567,6 @@ dumpobjs(void) ...@@ -567,7 +567,6 @@ dumpobjs(void)
s = runtime·mheap.allspans[i]; s = runtime·mheap.allspans[i];
if(s->state != MSpanInUse) if(s->state != MSpanInUse)
continue; continue;
runtime·MSpan_EnsureSwept(s);
p = (byte*)(s->start << PageShift); p = (byte*)(s->start << PageShift);
size = s->elemsize; size = s->elemsize;
n = (s->npages << PageShift) / size; n = (s->npages << PageShift) / size;
...@@ -694,6 +693,15 @@ static void ...@@ -694,6 +693,15 @@ static void
mdump(G *gp) mdump(G *gp)
{ {
byte *hdr; byte *hdr;
uintptr i;
MSpan *s;
// make sure we're done sweeping
for(i = 0; i < runtime·mheap.nspan; i++) {
s = runtime·mheap.allspans[i];
if(s->state == MSpanInUse)
runtime·MSpan_EnsureSwept(s);
}
runtime·memclr((byte*)&typecache[0], sizeof(typecache)); runtime·memclr((byte*)&typecache[0], sizeof(typecache));
hdr = (byte*)"go1.3 heap dump\n"; hdr = (byte*)"go1.3 heap dump\n";
......
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