src/runtime/malloc.go | 6 +++++- diff --git a/src/runtime/malloc.go b/src/runtime/malloc.go index 885065974834f15f634e9afcf5dc10311d84e05c..0ebd2c0ab2306afa4006c00dfac820b203e3fce9 100644 --- a/src/runtime/malloc.go +++ b/src/runtime/malloc.go @@ -416,7 +416,10 @@ // is reserved and part is not. var reserved bool p := uintptr(sysReserve(unsafe.Pointer(h.arena_end), p_size, &reserved)) if p == 0 { - return nil + // TODO: Try smaller reservation + // growths in case we're in a crowded + // 32-bit address space. + goto reservationFailed } // p can be just about anywhere in the address // space, including before arena_end. @@ -476,6 +479,7 @@ } return unsafe.Pointer(p) } +reservationFailed: // If using 64-bit, our reservation is all we have. if sys.PtrSize != 4 { return nil