delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/05/29/02:05:10

To: djgpp AT delorie DOT com
From: lizard AT forum DOT ncdl DOT com (Lizard)
Date: Tue, 28 May 1996 23:53:13 -0700
Organization: The Forum BBS (970) 229-9750
Subject: Re: Trapping failed malloc cal
Message-ID: <43f.485.299@forum.ncdl.com>

 > That IS the only way to check for running out of memory, unless you
 > want to hack malloc()'s internal structures.  Just check for NULL, and
 > exit if you see it.  More complex solutions could involve calling a
 > trap function which, by examining calls to malloc() with lesser amounts
 > of memory, figures out how much memory you actually need, but that is
 > pretty extreme, especially with virtual memory.  Besides, due to the
 > way malloc() functions, there could be a bunch of small blocks of free
 > memory floating around that together make up a substantial amount, but
 > individually aren't enough for anything.

I don't know if xmalloc() is an ANSI function but, according to the libc
docs, xmalloc() automatically prints an error and exits if now memory is
available.

 - Lizard of CAPRICE


~~~ Blue Wave/RA v2.12 [NR]


-----------------------------------------------------------------------------
Internet: lizard AT forum DOT ncdl DOT com (Lizard)
The views stated are those of the sender and may be those The Forum BBS
This message was processed by NetXpress from Merlin Systems Inc.
-----------------------------------------------------------------------------

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019