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....)