mirror of
https://github.com/golang/go
synced 2024-11-26 08:27:56 -07:00
runtime: check for sysAlloc failures in pageAlloc
Change-Id: I78c5744bb01988f1f599569703d83fd21542ac7a Reviewed-on: https://go-review.googlesource.com/c/go/+/305911 Trust: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com>
This commit is contained in:
parent
c93cd86149
commit
0e8a72b62e
@ -395,6 +395,9 @@ func (p *pageAlloc) grow(base, size uintptr) {
|
|||||||
// Store it atomically to avoid races with readers which
|
// Store it atomically to avoid races with readers which
|
||||||
// don't acquire the heap lock.
|
// don't acquire the heap lock.
|
||||||
r := sysAlloc(unsafe.Sizeof(*p.chunks[0]), p.sysStat)
|
r := sysAlloc(unsafe.Sizeof(*p.chunks[0]), p.sysStat)
|
||||||
|
if r == nil {
|
||||||
|
throw("pageAlloc: out of memory")
|
||||||
|
}
|
||||||
atomic.StorepNoWB(unsafe.Pointer(&p.chunks[c.l1()]), r)
|
atomic.StorepNoWB(unsafe.Pointer(&p.chunks[c.l1()]), r)
|
||||||
}
|
}
|
||||||
p.chunkOf(c).scavenged.setRange(0, pallocChunkPages)
|
p.chunkOf(c).scavenged.setRange(0, pallocChunkPages)
|
||||||
|
Loading…
Reference in New Issue
Block a user