Why would malloc return NULL?

Pierre A. Humblet Pierre.Humblet@eurecom.fr
Fri Nov 13 20:14:00 GMT 1998


I have got exactly the same problem when porting gnu spell-1.0 to b19, see
ftp://ftp.franken.de/pub/win32/develop/gnuwin32/cygwin32/porters/Humblet_Pie
rre_A/B19/ispell.readme

The problem persists in b20. It seems to be related to the number of
outstanding malloc calls and not to the total memory allocated. In my case
it was easier to modify the source to free blocks ASAP rather than trying
to understand and fix b19...

Pierre


At 04:18 PM 11/12/98 -0500, francesd@adstii.com wrote:
>
>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