Subject: Why would malloc return NULL?
From: [email-masked] (Derrick Franceschini)

13 Nov 1998 06:12:06 -0800
Message-ID: <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
To: [email-masked]

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
[email-masked]                        Phone (407)-306-4113
                                           Fax   (407)-306-4075
-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".