bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: new module 'get-rusage-as'


From: Bruno Haible
Subject: Re: new module 'get-rusage-as'
Date: Wed, 26 Jan 2011 13:46:22 +0100
User-agent: KMail/1.9.9

On 2011-01-18 I wrote:
> When I reintroduce the memory leak fixed on 2009-12-15, the output on
> MacOS X and Cygwin thus changes from
> 
>   Skipping test: getrlimit and setrlimit don't work
>   SKIP: test-dprintf-posix2.sh
>   Skipping test: getrlimit and setrlimit don't work
>   SKIP: test-fprintf-posix3.sh
> 
> to
> 
>   FAIL: test-dprintf-posix2.sh
>   FAIL: test-fprintf-posix3.sh

The tests are still skipped on AIX and OpenBSD.

With the info (written in the comments of lib/get-rusage-data.c) it's
now also possible to enable them on AIX, because we know that on this
platform, setrlimit of RLIMIT_DATA works and actually limits malloc().
(Whereas on OpenBSD, setrlimit of RLIMIT_DATA works but it does not
constrain malloc().)

There's no win in using the 'get-rusage-data' module in this case
actually, since get_rusage_data() is more capable than setrlimit of
RLIMIT_DATA only on MacOS X, Cygwin, mingw, Haiku, and on these platforms
get_rusage_as() is already working fine.


2011-01-26  Bruno Haible  <address@hidden>

        Enable memory leak tests on AIX.
        * tests/test-dprintf-posix2.c (main): Don't skip the test on AIX.
        * tests/test-fprintf-posix3.c (main): Likewise.

--- tests/test-dprintf-posix2.c.orig    Wed Jan 26 13:35:06 2011
+++ tests/test-dprintf-posix2.c Wed Jan 26 13:27:16 2011
@@ -55,7 +55,7 @@
 
   /* Limit the amount of malloc()ed memory to MAX_ALLOC_TOTAL or less.  */
 
-  /* On BSD systems, malloc() is limited by RLIMIT_DATA.  */
+  /* On AIX systems, malloc() is limited by RLIMIT_DATA.  */
 #if HAVE_GETRLIMIT && HAVE_SETRLIMIT && defined RLIMIT_DATA
   {
     struct rlimit limit;
@@ -69,12 +69,14 @@
       }
   }
 #endif
-  /* On Linux systems, malloc() is limited by RLIMIT_AS.
+  /* On all systems except AIX and OpenBSD, malloc() is limited by RLIMIT_AS.
      On some systems, setrlimit of RLIMIT_AS doesn't work but get_rusage_as ()
      does.  Allow the address space size to grow by at most MAX_ALLOC_TOTAL.  
*/
   initial_rusage_as = get_rusage_as ();
+#if !defined _AIX
   if (initial_rusage_as == 0)
     return 77;
+#endif
 
   arg = atoi (argv[1]);
   if (arg == 0)
--- tests/test-fprintf-posix3.c.orig    Wed Jan 26 13:35:06 2011
+++ tests/test-fprintf-posix3.c Wed Jan 26 13:27:16 2011
@@ -54,7 +54,7 @@
 
   /* Limit the amount of malloc()ed memory to MAX_ALLOC_TOTAL or less.  */
 
-  /* On BSD systems, malloc() is limited by RLIMIT_DATA.  */
+  /* On AIX systems, malloc() is limited by RLIMIT_DATA.  */
 #if HAVE_GETRLIMIT && HAVE_SETRLIMIT && defined RLIMIT_DATA
   {
     struct rlimit limit;
@@ -68,12 +68,14 @@
       }
   }
 #endif
-  /* On Linux systems, malloc() is limited by RLIMIT_AS.
+  /* On all systems except AIX and OpenBSD, malloc() is limited by RLIMIT_AS.
      On some systems, setrlimit of RLIMIT_AS doesn't work but get_rusage_as ()
      does.  Allow the address space size to grow by at most MAX_ALLOC_TOTAL.  
*/
   initial_rusage_as = get_rusage_as ();
+#if !defined _AIX
   if (initial_rusage_as == 0)
     return 77;
+#endif
 
   arg = atoi (argv[1]);
   if (arg == 0)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]