Commit 233d8150 authored by Ben Gamari's avatar Ben Gamari Committed by Ben Gamari
Browse files

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
parent d24e73ad
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment