Change-Id: I5e6739ff0c6c561195ed9891fb90f933b81e7750
Reviewed-on: https://go-review.googlesource.com/17746
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
// Nobody cares about the credit. Avoid the atomic.
return
}
- atomic.Xadd64(&mheap_.spanBytesAlloc, -int64(unusableBytes))
+ if int64(atomic.Xadd64(&mheap_.spanBytesAlloc, -int64(unusableBytes))) < 0 {
+ throw("spanBytesAlloc underflow")
+ }
}
func dumpFreeList(s *mspan) {