GMP terminates when out of memory

Bjarke Roune bjarke at daimi.au.dk
Wed Dec 24 01:33:17 CET 2008


> What sort of behaviour would you suggest?
>
> I suppose much of this can be done with the custom allocation interface
> already.
>
A reasonable behavior would be to return an error code or set an error
flag. The C++ interface could check for error and throw an exception.
The harder part of this is to make sure that GMP responds to failure
by putting the objects involved in the computation into some valid
state and then returns without leaking memory. In the case of the
library I am working on, this kind of thing turned out to be more
tricky than I had thought.

/Bjarke


More information about the gmp-discuss mailing list