diff options
author | Ben Gamari <bgamari.foss@gmail.com> | 2018-06-14 09:19:11 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2018-06-14 10:03:28 -0400 |
commit | 233d8150e672494dc5764d0dad5ea721a56517a1 (patch) | |
tree | 673dd5cc5c458c0da373e329b0850bc76dcd6234 /rts/posix | |
parent | d24e73adf7fb33e2c94b7b6c43fe9feb9b23c3a6 (diff) | |
download | haskell-233d8150e672494dc5764d0dad5ea721a56517a1.tar.gz |
rts: Ignore RLIMIT_AS if it is zero
Reviewers: erikd, simonmar
Reviewed By: simonmar
Subscribers: rwbarton, thomie, carter
GHC Trac Issues: #14492
Differential Revision: https://phabricator.haskell.org/D4811
Diffstat (limited to 'rts/posix')
-rw-r--r-- | rts/posix/OSMem.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/rts/posix/OSMem.c b/rts/posix/OSMem.c index 479ae9dee1..e63e798be9 100644 --- a/rts/posix/OSMem.c +++ b/rts/posix/OSMem.c @@ -508,7 +508,9 @@ void *osReserveHeapMemory(void *startAddressPtr, W_ *len) #if defined(HAVE_SYS_RESOURCE_H) && defined(HAVE_SYS_TIME_H) struct rlimit limit; - if (!getrlimit(RLIMIT_AS, &limit) && *len > limit.rlim_cur) { + if (!getrlimit(RLIMIT_AS, &limit) + && limit.rlim_cur > 0 + && *len > limit.rlim_cur) { *len = limit.rlim_cur; } #endif |