diff options
| author | Russ Cox <rsc@golang.org> | 2011-04-25 12:13:54 -0400 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2011-04-25 12:13:54 -0400 |
| commit | a8bf6f32cc9cfbfee28a47a54fcb2bc5f4368a38 (patch) | |
| tree | 5b93b05b9cea8b1faef00be9f890a37705d471ee /src/pkg/runtime/linux | |
| parent | 4efdeeec51f873704cf787632dc350d15c670f2a (diff) | |
| download | go-a8bf6f32cc9cfbfee28a47a54fcb2bc5f4368a38.tar.xz | |
runtime: correct out of memory error
Fixes #1511.
R=golang-dev, iant2
CC=golang-dev
https://golang.org/cl/4433065
Diffstat (limited to 'src/pkg/runtime/linux')
| -rw-r--r-- | src/pkg/runtime/linux/mem.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/pkg/runtime/linux/mem.c b/src/pkg/runtime/linux/mem.c index d2f6f82046..ce1a8aa70b 100644 --- a/src/pkg/runtime/linux/mem.c +++ b/src/pkg/runtime/linux/mem.c @@ -48,6 +48,11 @@ runtime·SysReserve(void *v, uintptr n) return runtime·mmap(v, n, PROT_NONE, MAP_ANON|MAP_PRIVATE, -1, 0); } +enum +{ + ENOMEM = 12, +}; + void runtime·SysMap(void *v, uintptr n) { @@ -66,6 +71,8 @@ runtime·SysMap(void *v, uintptr n) } p = runtime·mmap(v, n, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_ANON|MAP_FIXED|MAP_PRIVATE, -1, 0); + if(p == (void*)-ENOMEM) + runtime·throw("runtime: out of memory"); if(p != v) runtime·throw("runtime: cannot map pages in arena address space"); } |
