This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Ping: [PATCH] Install error handler for out-of-memory when using STL containers
- From: Paul Richard Thomas <paul dot richard dot thomas at gmail dot com>
- To: Tobias Schlüter <tobias dot schlueter at physik dot uni-muenchen dot de>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>, Fortran List <fortran at gcc dot gnu dot org>
- Date: Mon, 29 Oct 2012 10:02:49 +0100
- Subject: Re: Ping: [PATCH] Install error handler for out-of-memory when using STL containers
- References: <507C7739.3070003@physik.uni-muenchen.de> <508D4F1F.6040301@physik.uni-muenchen.de>
Hi Tobi,
It looks straightforward to me but I am not convinced that a fortran
maintainer should be giving the green light on this :-)
Cheers
Paul
On 28 October 2012 16:28, Tobias Schlüter
<tobias.schlueter@physik.uni-muenchen.de> wrote:
>
> Ping. This issue stands in the way of a very simple solution of PR
> fortran/51727. I've re-attached the patch for your convenience.
>
> On 15 Oct 2012 at 22:51:05 +0200 Tobias Schlüter wrote:
>>
>> The attached patch adds out-of-memory diagnostics for code using STL
>> containers by using set_new_handler. Since the intended allocation
>> size is not available to a new_handler, I had to forego a more
>> detailed error message such as the one from xmalloc_failed().
>> fatal_error() and abort() don't give a meaningful location when the
>> new_handler is called, so I chose to put together the error message
>> manually as is done in xmalloc_failed(). I would have found it more
>> appealing to have operator new call xmalloc() unless a custom
>> allocator is given, but I don't think there's a standard way of doing
>> this.
>>
>> Built and tested on the C and Fortran testsuites. Ok for trunk?
>
>
> Best regards,
> - Tobi
>
> 2012-10-15 Tobias Schlüter <tobi@gcc.gnu.org>
>
> * toplev.c: Add '#include <new>'.
> (cxx_out_of_memory): New function.
> (general_init): Install cxx_out_of_memory as handler for
> out-of-memory condition.
--
The knack of flying is learning how to throw yourself at the ground and miss.
--Hitchhikers Guide to the Galaxy