delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/05/25/01:10:17

Xref: news2.mv.net comp.os.msdos.djgpp:4240
From: malcolm AT manawatu DOT gen DOT nz (Malcolm Taylor)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Trapping failed malloc calls
Date: Sat, 25 May 1996 01:49:43 GMT
Organization: Grafik Software
Lines: 18
Message-ID: <4o5snl$he4@news.manawatu.gen.nz>
References: <4o40cb$khi AT news DOT manawatu DOT gen DOT nz>
Reply-To: malcolm AT manawatu DOT gen DOT nz
NNTP-Posting-Host: malcolm.manawatu.gen.nz
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

malcolm AT manawatu DOT gen DOT nz (Malcolm Taylor) wrote:
>I would like to be able to trap a failed call to malloc (or new) and 
>exit gracefully with a message about running out of memory.

I seem to have been a little imprecise here. I know that you can check
for NULL return from malloc, and I know about the new handler. I was
wondering about more non-standard methods (or standard practices) to
get the above result. Basicly I coded assuming I had enough memory,
this is almost always true in dos (unless I have a memory leak), but
under Windows and OS/2 the amount of memory given to the program is
often too small, in these cases I would like my already written code
to be able to exit a little more gracefully.

Thanks,
Malcolm



- Raw text -


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