install
Kriang Lerdsuwanakij
lerdsuwa@scf-fs.usc.edu
Tue Apr 21 23:21:00 GMT 1998
Peter Garner wrote:
> Yet I wrote a small test
> program that simply allocates more memory with the new [] operator
> than the system can possibly allocate. This program aborts with an
> error message stating something to the effect that an attempt to
> allocate virtual memory faild. Of course the ISO/ANSI behaviour is
> to throw an exception of type bad_alloc in this case. Have I done
> something wrong or failed to enable something?
I guess you are using egcs 1.0.2. For egcs 1.0.x, the behavior when new
cannot allocate memory is displaying memory exhaust error and abort.
For latest egcs snapshot, bad_alloc is thrown.
With egcs 1.0.x, you can get the desired behavior by using
set_new_handler and throwing an exception inside your new handler.
However it does not always work as exception handling code needs some
free memory to operate which is also true for the latest egcs snapshot.
For more info, see http://www.cygnus.com/ml/egcs/1998-Mar/0320.html
> Will using the latest libg++ (libg++-2.8.1-980415.tar.gz) rectify
> this?
No.
--Kriang
More information about the Gcc
mailing list