This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/12232] setrlimit interferes with malloc
- From: "bkorb at gnu dot org" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: Fri, 7 Jan 2011 23:31:21 +0000
- Subject: [Bug libc/12232] setrlimit interferes with malloc
- Auto-submitted: auto-generated
- References: <bug-12232-131@http.sourceware.org/bugzilla/>
http://sourceware.org/bugzilla/show_bug.cgi?id=12232
--- Comment #11 from Bruce Korb <bkorb at gnu dot org> 2011-01-07 23:31:06 UTC ---
One more data point. The following program does not show
the problem. So, calling free(malloc(0x88)) clears the issue
and the following code doesn't stumble.
#define NUM_ROUNDS 1000
#define MAX_ALLOC_ROUND 10000
#define MAX_ALLOC_TOTAL (NUM_ROUNDS * MAX_ALLOC_ROUND)
int
main(int argc, char ** argv)
{
struct rlimit limit;
if (getrlimit (RLIMIT_AS, &limit) < 0)
return 77;
if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > MAX_ALLOC_TOTAL)
limit.rlim_max = MAX_ALLOC_TOTAL;
limit.rlim_cur = limit.rlim_max;
if (setrlimit (RLIMIT_AS, &limit) < 0)
return 77;
if (dprintf (STDOUT_FILENO, "%011000d\n", 17) == -1
&& errno == ENOMEM)
return 1;
return 0;
}
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.