aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/runtime/stack.c
diff options
context:
space:
mode:
authorDmitriy Vyukov <dvyukov@google.com>2014-03-14 21:22:03 +0400
committerDmitriy Vyukov <dvyukov@google.com>2014-03-14 21:22:03 +0400
commitd8e6881166e280cc44056f1a6c9747a103dca340 (patch)
tree73e5de7f6f3ab87b31fc45efead2ef6e2c9639af /src/pkg/runtime/stack.c
parent0da73b9f073b2b1e9b78b3a6f6bc077101a05658 (diff)
downloadgo-d8e6881166e280cc44056f1a6c9747a103dca340.tar.xz
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
Diffstat (limited to 'src/pkg/runtime/stack.c')
-rw-r--r--src/pkg/runtime/stack.c8
1 files changed, 6 insertions, 2 deletions
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