]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: debug prints for spanBytesAlloc underflow
authorAustin Clements <austin@google.com>
Tue, 20 Dec 2016 03:55:53 +0000 (22:55 -0500)
committerAustin Clements <austin@google.com>
Tue, 10 Jan 2017 15:59:39 +0000 (15:59 +0000)
Updates #18043.

Change-Id: I24e687fdd5521c48b672987f15f0d5de9f308884
Reviewed-on: https://go-review.googlesource.com/34612
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Rick Hudson <rlh@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/runtime/mgcsweep.go

index e74a451d0d44f7b8f69df6a58f61113a70f0f99a..fb5c488ffc37ed87e22ac91c569928842dd3940c 100644 (file)
@@ -405,7 +405,10 @@ func reimburseSweepCredit(unusableBytes uintptr) {
                // Nobody cares about the credit. Avoid the atomic.
                return
        }
-       if int64(atomic.Xadd64(&mheap_.spanBytesAlloc, -int64(unusableBytes))) < 0 {
+       nval := atomic.Xadd64(&mheap_.spanBytesAlloc, -int64(unusableBytes))
+       if int64(nval) < 0 {
+               // Debugging for #18043.
+               print("runtime: bad spanBytesAlloc=", nval, " (was ", nval+uint64(unusableBytes), ") unusableBytes=", unusableBytes, " sweepPagesPerByte=", mheap_.sweepPagesPerByte, "\n")
                throw("spanBytesAlloc underflow")
        }
 }