Why would malloc return NULL?

Derrick Franceschini francesd@adstii.com
Thu Nov 12 16:07:00 GMT 1998


We have ported a large Unix application to NT using Cygwin (b19) and
seem to have a problem with malloc returning NULL when there is still
plenty of unused memory.  The machine has 256M of RAM, and 512M of
swap.  We attempted to allocate 16 bytes when malloc returned NULL,
and according to the task manager, we have over 130M of unused
physical RAM.  I tried linking in the mmalloc library to track down
what was causing this, but that just seemed to delay the problem.  To
make matters worse, everything ran just fine when in the debugger (and
mmalloc was linked in).  Also, the problem goes away when you compile
with debug information.

In Unix, the only reasons I would expect for malloc to return NULL is
if the system ran out of memory or someone trashed the memory
allocation tables.  I think I can rule out running out of memory
(unless someone can suggest why this could happen with that much space
left), so are there any other reasons why this could happen in Cygwin?

Thanks,
-Derrick

-- 
Derrick Franceschini                    SAIC -- ADST II -- ModSAF
francesd@adstii.com                        Phone (407)-306-4113
                                           Fax   (407)-306-4075
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".



More information about the Cygwin mailing list