diff options
| author | Russ Cox <rsc@golang.org> | 2015-01-14 15:48:32 -0500 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2015-01-14 20:50:35 +0000 |
| commit | 3423b7b40a568466a3566f8139d88f3a80e81e7e (patch) | |
| tree | 11efed222ec8792face0aa82708c23756bf47c80 /src/runtime/malloc.go | |
| parent | 0e84088715a2242fbc99b813ac25ac60b21d997a (diff) | |
| download | go-3423b7b40a568466a3566f8139d88f3a80e81e7e.tar.xz | |
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/2822
Reviewed-by: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/runtime/malloc.go')
| -rw-r--r-- | src/runtime/malloc.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/runtime/malloc.go b/src/runtime/malloc.go index eb895a95ae..90cf7360fc 100644 --- a/src/runtime/malloc.go +++ b/src/runtime/malloc.go @@ -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) |
