diff options
author | Russ Cox <rsc@golang.org> | 2011-04-27 23:20:53 -0400 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2011-04-27 23:20:53 -0400 |
commit | 70b0de8e981efbe6e37d60df430c9077db9bda7a (patch) | |
tree | d68256b0e2741ade09bf4681d9c5b5097f869066 | |
parent | 33ca16d616c93510b15e64c377d79112fae7c2f7 (diff) | |
download | go-70b0de8e981efbe6e37d60df430c9077db9bda7a.tar.gz go-70b0de8e981efbe6e37d60df430c9077db9bda7a.zip |
runtime: allow use of >512 MB on 32-bit platforms
runtime: memory allocated by OS not in usable range
runtime: out of memory: cannot allocate 1114112-byte block (2138832896 in use)
throw: out of memory
runtime.throw+0x40 /Users/rsc/g/go/src/pkg/runtime/runtime.c:102
runtime.throw(0x1fffd, 0x101)
runtime.mallocgc+0x2af /Users/rsc/g/go/src/pkg/runtime/malloc.c:60
runtime.mallocgc(0x100004, 0x0, 0x1, 0x1, 0xc093, ...)
runtime.mal+0x40 /Users/rsc/g/go/src/pkg/runtime/malloc.c:289
runtime.mal(0x100004, 0x20bc4)
runtime.new+0x26 /Users/rsc/g/go/src/pkg/runtime/malloc.c:296
runtime.new(0x100004, 0x8fe84000, 0x20bc4)
main.main+0x29 /Users/rsc/x.go:11
main.main()
runtime.mainstart+0xf /Users/rsc/g/go/src/pkg/runtime/386/asm.s:93
runtime.mainstart()
runtime.goexit /Users/rsc/g/go/src/pkg/runtime/proc.c:178
runtime.goexit()
----- goroutine created by -----
_rt0_386+0xbf /Users/rsc/g/go/src/pkg/runtime/386/asm.s:80
R=iant, r
CC=golang-dev
https://golang.org/cl/4444073
-rw-r--r-- | src/pkg/runtime/malloc.goc | 2 | ||||
-rw-r--r-- | src/pkg/runtime/mheap.c | 8 |
2 files changed, 3 insertions, 7 deletions
diff --git a/src/pkg/runtime/malloc.goc b/src/pkg/runtime/malloc.goc index 41060682eb..1f2d6da404 100644 --- a/src/pkg/runtime/malloc.goc +++ b/src/pkg/runtime/malloc.goc @@ -346,7 +346,7 @@ runtime·MHeap_SysAlloc(MHeap *h, uintptr n) return nil; if(p < h->arena_start || p+n - h->arena_start >= MaxArena32) { - runtime·printf("runtime: memory allocated by OS not in usable range"); + runtime·printf("runtime: memory allocated by OS not in usable range\n"); runtime·SysFree(p, n); return nil; } diff --git a/src/pkg/runtime/mheap.c b/src/pkg/runtime/mheap.c index a36ac15ba1..dde31ce345 100644 --- a/src/pkg/runtime/mheap.c +++ b/src/pkg/runtime/mheap.c @@ -180,11 +180,7 @@ MHeap_Grow(MHeap *h, uintptr npage) // Allocate a multiple of 64kB (16 pages). npage = (npage+15)&~15; ask = npage<<PageShift; - if(ask > h->arena_end - h->arena_used) { - runtime·printf("runtime: out of memory: no room in arena for %D-byte allocation (%D in use)\n", (uint64)ask, (uint64)(h->arena_used - h->arena_start)); - return false; - } - if(ask < HeapAllocChunk && HeapAllocChunk <= h->arena_end - h->arena_used) + if(ask < HeapAllocChunk) ask = HeapAllocChunk; v = runtime·MHeap_SysAlloc(h, ask); @@ -194,7 +190,7 @@ MHeap_Grow(MHeap *h, uintptr npage) v = runtime·MHeap_SysAlloc(h, ask); } if(v == nil) { - runtime·printf("runtime: out of memory: operating system refused %D-byte allocation\n", (uint64)ask); + runtime·printf("runtime: out of memory: cannot allocate %D-byte block (%D in use)\n", (uint64)ask, mstats.heap_sys); return false; } } |