Commit 3423b7b4 authored by Russ Cox's avatar Russ Cox

runtime: fix bugs in previous commit

These were fixed in my local commit,
but I forgot that the web Submit button can't see that.

Change-Id: Iec3a70ce3ccd9db2a5394ae2da0b293e45ac2fb5
Reviewed-on: https://go-review.googlesource.com/2822Reviewed-by: default avatarRuss Cox <rsc@golang.org>
parent 0e840887
......@@ -128,7 +128,7 @@ func mallocgc(size uintptr, typ *_type, flags uint32) unsafe.Pointer {
} else if size&1 == 0 {
off = round(off, 2)
}
if off+size <= maxTinySize {
if off+size <= maxTinySize && c.tiny != nil {
// The object fits into existing tiny block.
x = add(c.tiny, off)
c.tinyoffset = off + size
......@@ -1042,7 +1042,7 @@ func persistentalloc(size, align uintptr, stat *uint64) unsafe.Pointer {
lock(&persistent.lock)
persistent.off = round(persistent.off, align)
if persistent.off+size > chunk {
if persistent.off+size > chunk || persistent.base == nil {
persistent.base = sysAlloc(chunk, &memstats.other_sys)
if persistent.base == nil {
unlock(&persistent.lock)
......
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