From: Dmitriy Vyukov Date: Fri, 14 Mar 2014 17:22:03 +0000 (+0400) Subject: runtime: report "out of memory" in efence mode X-Git-Tag: go1.3beta1~355 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=d8e6881166e280cc44056f1a6c9747a103dca340;p=gostls13.git 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 --- diff --git a/src/pkg/runtime/stack.c b/src/pkg/runtime/stack.c index 81005de5d7..c0b98634d7 100644 --- a/src/pkg/runtime/stack.c +++ b/src/pkg/runtime/stack.c @@ -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