www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/05/24/09:36:00

Xref: news2.mv.net comp.os.msdos.djgpp:4215
From: malcolm AT manawatu DOT gen DOT nz (Malcolm Taylor)
Newsgroups: comp.os.msdos.djgpp
Subject: Trapping failed malloc calls
Date: Fri, 24 May 1996 08:39:40 GMT
Organization: Grafik Software
Lines: 16
Message-ID: <4o40cb$khi@news.manawatu.gen.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

Hi,
	I am wondering if there is an easy way of trapping failed malloc and
new calls within a program. At present the program will just exit with
a stack trace that often hides the fact that the program is simply
running out of memory (eg a memory leak bug maybe). 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.
	Also if anyone has any better malloc for wide ranging sizes than the
standard malloc I would be interested. One particular program I've
written mallocs blocks that are from between 100b and 4Mb in size
(approx) and the normal malloc seems to use more memory than it needs.
If you know of one then please e-mail me about it.

Thanks,
Malcolm

- Raw text -


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