]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: report "out of memory" in efence mode
authorDmitriy Vyukov <dvyukov@google.com>
Fri, 14 Mar 2014 17:22:03 +0000 (21:22 +0400)
committerDmitriy Vyukov <dvyukov@google.com>
Fri, 14 Mar 2014 17:22:03 +0000 (21:22 +0400)
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

src/pkg/runtime/stack.c

index 81005de5d7ba9f83f6cb35dd8f32b57b6f461bf6..c0b98634d76d6ec1adb0f62fd60b270efc938999 100644 (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