Skip to content

Commit

Permalink
rts/posix: Ensure that memory commit succeeds
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bgamari committed Oct 16, 2017
1 parent c5da84d commit a69fa54
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion rts/posix/OSMem.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit a69fa54

Please sign in to comment.