]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: allow use of >512 MB on 32-bit platforms
authorRuss Cox <rsc@golang.org>
Thu, 28 Apr 2011 03:20:53 +0000 (23:20 -0400)
committerRuss Cox <rsc@golang.org>
Thu, 28 Apr 2011 03:20:53 +0000 (23:20 -0400)
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

src/pkg/runtime/malloc.goc
src/pkg/runtime/mheap.c

index 41060682ebf0883c9770de6df578189dfbfe5419..1f2d6da404d4c5db562c56bd0ec0293ce4b1ff19 100644 (file)
@@ -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;
        }
index a36ac15ba1941cd3163498cb5f968b1f5c0053ad..dde31ce3457f2e887fe925fffc842608458dd607 100644 (file)
@@ -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;
                }
        }