1
0
mirror of https://github.com/golang/go synced 2024-11-12 03:50:21 -07:00

runtime: report "out of memory" in efence mode

Currently processes crash with obscure message.
Say that it's "out of memory".

LGTM=rsc
R=golang-codereviews
CC=golang-codereviews, khr, rsc
https://golang.org/cl/75820045
This commit is contained in:
Dmitriy Vyukov 2014-03-14 21:22:03 +04:00
parent 0da73b9f07
commit d8e6881166

View File

@ -102,8 +102,12 @@ runtime·stackalloc(G *gp, uint32 n)
runtime·printf("stackalloc %d\n", n);
gp->stacksize += n;
if(runtime·debug.efence || StackFromSystem)
return runtime·SysAlloc(ROUND(n, PageSize), &mstats.stacks_sys);
if(runtime·debug.efence || StackFromSystem) {
v = runtime·SysAlloc(ROUND(n, PageSize), &mstats.stacks_sys);
if(v == nil)
runtime·throw("out of memory (stackalloc)");
return v;
}
// Minimum-sized stacks are allocated with a fixed-size free-list allocator,
// but if we need a stack of a bigger size, we fall back on malloc