[Gllug] My and my malloc() problems....
Darran D. Rimron-Molloy
ddrm at digital-science.net
Wed Dec 26 00:39:40 UTC 2001
Hiya,
For the last 24 hours, I have been seeing some very odd behaviour from some
code I am hacking together....
First of all, the machine IS NOT running out of ram, and the malloc itself
isn't failing. I've written my own version of malloc (called my_malloc, of
course)
void *my_malloc(size_t size)
{
void *ret;
if(!(ret = malloc(size))) {
fprintf(stderr, "\n\nOut of memory\n\n");
exit(1);
}
return ret;
}
Anyway, with, or without, this in place a malloc in one place of the code...
next_item = (program_item *)malloc(sizeof(program_item));
fails when I remove a sleep(1) statement from elsewhere in my code, in a
different routine, prior to the malloc by about 30 or 40 statements.... the
same error also occours when I remove a nanosleep(0,200) from the code, the
line prior to the malloc....
Is there something I don't know about malloc()?!
Please, can ANYONE help?
-Cheers, Darran
--
Gllug mailing list - Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug
More information about the GLLUG
mailing list