bug-gnulib
[Top][All Lists]
Advanced

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

setrlimit


From: Bruce Korb
Subject: setrlimit
Date: Tue, 16 Nov 2010 10:50:56 -0800
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.12) Gecko/20100914 SUSE/3.0.8 Thunderbird/3.0.8

After this gdb session:

> Breakpoint 1, main (argc=1, argv=0x7fffffffdd38)
>     at ../../tests/test-dprintf-posix2.c:57
> 57        if (getrlimit (RLIMIT_DATA, &limit) < 0)
> (gdb) n
> 59        if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > 
> MAX_ALLOC_TOTAL)
> (gdb) 
> 60          limit.rlim_max = MAX_ALLOC_TOTAL;
> (gdb) 
> 61        limit.rlim_cur = limit.rlim_max;
> (gdb) 
> 62        if (setrlimit (RLIMIT_DATA, &limit) < 0)
> (gdb) 
> 67        if (getrlimit (RLIMIT_AS, &limit) < 0)
> (gdb) 
> 69        if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > 
> MAX_ALLOC_TOTAL)
> (gdb) 
> 70          limit.rlim_max = MAX_ALLOC_TOTAL;
> (gdb) 
> 71        limit.rlim_cur = limit.rlim_max;
> (gdb) 
> 72        if (setrlimit (RLIMIT_AS, &limit) < 0)
> (gdb) 
> 79          memory = malloc (0x88);
> (gdb) 
> 80          if (memory == NULL)
> (gdb) p memory
> $1 = (void *) 0x0

I decided to insert malloc(0x88) + free() calls every few lines
to see how it would behave.  It worked correctly.  I removed the
extra malloc calls and then it worked correctly and has not
failed again after several tests, despite reverting the code
back to the original failing state.  I have not rebooted my
system and retried the original test.  There is something
awry that bothers both my system and Gary's system sometimes.
Not always.  My money is on some bizarre state that causes
a setrlimit/malloc interference that has now cleared itself.
(Not very much money, mind you....)



reply via email to

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