[commit: ghc] master: rts: Ignore RLIMIT_AS if it is zero (233d815)

git at git.haskell.org git at git.haskell.org
Thu Jun 14 14:07:34 UTC 2018


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/233d8150e672494dc5764d0dad5ea721a56517a1/ghc

>---------------------------------------------------------------

commit 233d8150e672494dc5764d0dad5ea721a56517a1
Author: Ben Gamari <bgamari.foss at gmail.com>
Date:   Thu Jun 14 09:19:11 2018 -0400

    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


>---------------------------------------------------------------

233d8150e672494dc5764d0dad5ea721a56517a1
 rts/posix/OSMem.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/rts/posix/OSMem.c b/rts/posix/OSMem.c
index 479ae9d..e63e798 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



More information about the ghc-commits mailing list