diff options
Diffstat (limited to 'libgo/runtime/mheap.c')
-rw-r--r-- | libgo/runtime/mheap.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/libgo/runtime/mheap.c b/libgo/runtime/mheap.c index b36df258818..cc6b3aff423 100644 --- a/libgo/runtime/mheap.c +++ b/libgo/runtime/mheap.c @@ -181,9 +181,7 @@ MHeap_Grow(MHeap *h, uintptr npage) // Allocate a multiple of 64kB (16 pages). npage = (npage+15)&~15; ask = npage<<PageShift; - if(ask > (uintptr)(h->arena_end - h->arena_used)) - return false; - if(ask < HeapAllocChunk && HeapAllocChunk <= h->arena_end - h->arena_used) + if(ask < HeapAllocChunk) ask = HeapAllocChunk; v = runtime_MHeap_SysAlloc(h, ask); @@ -192,8 +190,10 @@ MHeap_Grow(MHeap *h, uintptr npage) ask = npage<<PageShift; v = runtime_MHeap_SysAlloc(h, ask); } - if(v == nil) + if(v == nil) { + runtime_printf("runtime: out of memory: cannot allocate %llu-byte block (%llu in use)\n", (unsigned long long)ask, (unsigned long long)mstats.heap_sys); return false; + } } mstats.heap_sys += ask; |