Patch to allow more granular aborting.
Marc Glisse
marc.glisse at inria.fr
Mon Mar 14 21:56:55 CET 2011
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.
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). Or maybe
wrap all gmp calls to remember the status of the allocator before the
call. (or compile gmp with a C++ compiler and tweak a bit the temp
allocation macros)
> 2. And this patch, for __gmp_invalid_operation
Looks like it would be simpler to make this function overridable, somewhat
like the allocation functions. For some reason, LD_PRELOAD wasn't able to
replace it on my system :-(
--
Marc Glisse
More information about the gmp-devel
mailing list