CVSROOT: /cvs/ppl
Module name: ppl
Changes by: zaffanella(a)cs.unipr.it 2002-02-14 11:32:33
Modified files:
src : GenSys.cc
Log message:
In method remove_invalid_lines_and_rays(), we do not need to keep the
generators sorted (this saves efficiency, since we were always calling
it with a possibly non-sorted system).
Using remove_invalid_lines_and_rays() in affine_image.
Patches:
http://www.cs.unipr.it/cgi-bin/cvsweb.cgi/ppl/src/GenSys.cc.diff?cvsroot=pp…
Matt Carter wrote:
>
> nisse(a)lysator.liu.se (Niels Möller) writes:
> >
> > There should be a list somewhere of "these are the things we want to
> > change next time we make a new version that isn't 100% compatible",
> > and deleting gmp_errno should be on that list. IMHO.
>
> Add to that list, the ability to recover from memory allocation failures.
>
> Currently, the GMP functions that call __gmp_allocate_func() generally do
> not check the return value for NULL. Further, many of them return void, so
> changing them to return an out-of-memory error code would change the GMP
> API.
>
> We use GMP in a mission critical system which regularly hits the limits of
> available memory, so GMP's behavior of requiring the application to
> terminate when out of memory was unacceptable.
This is indeed unacceptable in many situations. And now that GMP
provides
a C++ interface, it is really desirable that a bad_alloc exception is
thrown
on memory allocation failure. I would say that it is desirable
_independently_
from the application (in our specific application we cannot simply
afford not
to have it). What we do now is to provide our own exception-throwing,
C++ allocation functions, installing them with
mp_set_memory_functions(cxx_malloc, cxx_realloc, cxx_free);
and making sure GMP has been compiled with the "-fexceptions" flag of
GCC,
something that can be done by configuring GMP with a command like
CPPFLAGS=-fexceptions my/path/to/gmp-4.0.1/configure ...
This seems to work quite well for us. I know this solution is not
blessed
by the GMP maintainers but, as far as I can tell, there is no other
option
at the moment.
All the best
Roberto
--
Prof. Roberto Bagnara
Computer Science Group
Department of Mathematics, University of Parma, Italy
http://www.cs.unipr.it/~bagnara/
mailto:bagnara@cs.unipr.it