Patch to allow more granular aborting.

Roberto Bagnara bagnara at
Tue Mar 15 13:15:35 CET 2011

On 03/14/2011 09:56 PM, Marc Glisse wrote:
> On Mon, 14 Mar 2011, Niels Möller wrote:
>> 1. About out-of-memory.
>> Can you explain why the current interface doesn't suffice? You can
>> provide your own allocation function, and make them raise an error in
>> any way you please on failure, instead of returning NULL to the caller.
> I think PPL does something like that. It requires GMP to be compiled
> with -fexceptions so it can throw a C++ exception from the
> allocator.

This is not entirely accurate.  The Parma Polyhedra Library (PPL) checks,
at configure time, whether GMP was compiled with -fexceptions.  In this
case it turns on some test programs that otherwise are not run by
`make check'.  These programs are meant to test the out-of-memory recovery
functionality of the PPL, something that is guaranteed not to work
unless GMP is compiled with -fexceptions.  Summarizing, the PPL neither
needs nor requires GMP to be compiled with -fexceptions; but the PPL
user may need that if recovering from an out-of-memory condition is

> But because of the way things are currently, if we want to continue
> after such an error, we have to either accept a possible memory leak
> or reinitialize the allocator (and forget all existing
> variables).

Right.  But for some applications the possible memory leak is often
negligible in size and the possibility to recover is much more valuable.


Prof. Roberto Bagnara                     CEO & CTO
Applied Formal Methods Laboratory         BUGSENG srl
Department of Mathematics                 Parco Area delle Scienze 53/A
University of Parma, Italy                I-43124 Parma, Italy
mailto:bagnara at                mailto:roberto.bagnara at

More information about the gmp-devel mailing list