Realloc returns NULL
Jeff Baumes
jeff.baumes@kitware.com
Thu Dec 18 22:11:00 GMT 2008
Is there any reason that realloc() could return NULL without running
out of memory on the system? My system memory is at 0.5GB out of 4GB
when it crashes, so it doesn't appear to be an out-of-memory error.
The requested realloc call is for 320K on a pointer that currently is
allocated for 160K. I am running a multi-threaded application, where
the failure occurs in a "worker" thread (not the main thread).
Valgrind does not come up with any memory errors. If I replace the
realloc with a malloc, memcpy, and free, the error does not appear. I
am using libc version 2.7 on Ubuntu, gcc version 4.2.4.
Thanks,
Jeff
More information about the Libc-help
mailing list