mirror of
https://github.com/golang/go
synced 2024-11-18 03:14:44 -07:00
runtime: check for spanBytesAlloc underflow
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>
This commit is contained in:
parent
6383fb6152
commit
c1cbe5b577
@ -393,7 +393,9 @@ func reimburseSweepCredit(unusableBytes uintptr) {
|
|||||||
// Nobody cares about the credit. Avoid the atomic.
|
// Nobody cares about the credit. Avoid the atomic.
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
atomic.Xadd64(&mheap_.spanBytesAlloc, -int64(unusableBytes))
|
if int64(atomic.Xadd64(&mheap_.spanBytesAlloc, -int64(unusableBytes))) < 0 {
|
||||||
|
throw("spanBytesAlloc underflow")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func dumpFreeList(s *mspan) {
|
func dumpFreeList(s *mspan) {
|
||||||
|
Loading…
Reference in New Issue
Block a user