diff options
author | Ben Gamari <bgamari.foss@gmail.com> | 2017-10-16 17:30:12 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2017-10-16 17:30:14 -0400 |
commit | a69fa5441c944d7f74c76bdae9f3dd198007ee42 (patch) | |
tree | bb4c7ab2237ccdeae2d971e52d16b0999dd6a06c /rts/posix | |
parent | c5da84db217735ccce47c2350a6917ee9ac00927 (diff) | |
download | haskell-a69fa5441c944d7f74c76bdae9f3dd198007ee42.tar.gz |
rts/posix: Ensure that memory commit succeeds
Previously we wouldn't check that mmap would succeed. I suspect this may
have been the cause of #14329.
Test Plan: Validate under low-memory condition
Reviewers: simonmar, austin, erikd
Reviewed By: simonmar
Subscribers: rwbarton, thomie
GHC Trac Issues: #14329
Differential Revision: https://phabricator.haskell.org/D4075
Diffstat (limited to 'rts/posix')
-rw-r--r-- | rts/posix/OSMem.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/rts/posix/OSMem.c b/rts/posix/OSMem.c index ee727a56c4..2f0bf3fe16 100644 --- a/rts/posix/OSMem.c +++ b/rts/posix/OSMem.c @@ -534,7 +534,10 @@ void *osReserveHeapMemory(void *startAddressPtr, W_ *len) void osCommitMemory(void *at, W_ size) { - my_mmap(at, size, MEM_COMMIT); + void *r = my_mmap(at, size, MEM_COMMIT); + if (r == NULL) { + barf("Unable to commit %d bytes of memory", size); + } } void osDecommitMemory(void *at, W_ size) |