Commit 2817e770 authored by Austin Clements's avatar Austin Clements

runtime: debug prints for spanBytesAlloc underflow

Updates #18043.

Change-Id: I24e687fdd5521c48b672987f15f0d5de9f308884
Reviewed-on: https://go-review.googlesource.com/34612
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: default avatarRick Hudson <rlh@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 7f1ff65c
...@@ -405,7 +405,10 @@ func reimburseSweepCredit(unusableBytes uintptr) { ...@@ -405,7 +405,10 @@ func reimburseSweepCredit(unusableBytes uintptr) {
// Nobody cares about the credit. Avoid the atomic. // Nobody cares about the credit. Avoid the atomic.
return 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") throw("spanBytesAlloc underflow")
} }
} }
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