]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: heapdump - make sure spans are swept before dumping.
authorKeith Randall <khr@golang.org>
Mon, 28 Apr 2014 16:45:00 +0000 (12:45 -0400)
committerKeith Randall <khr@golang.org>
Mon, 28 Apr 2014 16:45:00 +0000 (12:45 -0400)
LGTM=rsc
R=golang-codereviews, adonovan, rsc
CC=golang-codereviews
https://golang.org/cl/90440043

src/pkg/runtime/heapdump.c

index e66dd6a7aed999eabe5ff5c5eac3b571f82a6d5d..9132e2c186ac121e51dbaa57002f528b1b608eb6 100644 (file)
@@ -567,7 +567,6 @@ dumpobjs(void)
                s = runtime·mheap.allspans[i];
                if(s->state != MSpanInUse)
                        continue;
-               runtime·MSpan_EnsureSwept(s);
                p = (byte*)(s->start << PageShift);
                size = s->elemsize;
                n = (s->npages << PageShift) / size;
@@ -694,6 +693,15 @@ static void
 mdump(G *gp)
 {
        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));
        hdr = (byte*)"go1.3 heap dump\n";