]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Raise RLIMIT_AS to max allowable, so that we can create the large mappings
authorJeremy Fitzhardinge <jeremy@valgrind.org>
Tue, 9 Mar 2004 00:57:45 +0000 (00:57 +0000)
committerJeremy Fitzhardinge <jeremy@valgrind.org>
Tue, 9 Mar 2004 00:57:45 +0000 (00:57 +0000)
we need to.  If the hard limit is set to low, then things will fail as
large mmaps fail.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2299

coregrind/stage1.c

index b73c32e0d249754c1e37650d54659be95f454205..c11a174596437ec70d92715ff1d24f2b358de392 100644 (file)
@@ -38,6 +38,7 @@
 #include <signal.h>
 #include <fcntl.h>
 #include <errno.h>
+#include <sys/resource.h>
 
 #include "vg_include.h"
 
@@ -196,6 +197,7 @@ static void hoops(void)
 
 int main(int argc, char **argv)
 {
+   struct rlimit rlim;
    const char *cp = getenv(VALGRINDLIB);
 
    if (cp != NULL)
@@ -205,6 +207,12 @@ int main(int argc, char **argv)
 
    our_argc = argc;
 
+   /* Set the address space limit as high as it will go, since we make
+      a lot of very large mappings. */
+   getrlimit(RLIMIT_AS, &rlim);
+   rlim.rlim_cur = rlim.rlim_max;
+   setrlimit(RLIMIT_AS, &rlim);
+
    /* move onto another stack so we can play with the main one */
    ume_go((addr_t)hoops, (addr_t)stack + sizeof(stack));
 }