abort on error - is this being addressed?
nisse at lysator.liu.se
Thu Aug 26 10:44:09 CEST 2010
Allan Chandler <allachan at au1.ibm.com> writes:
> Does anyone else have any thoughts on this? I'd be interested in
> taking on the task myself if need be, at least initially.
There are two approaches I'm aware of, neither very practical with
the current GMP:
1. Have an alternative set of functions where the caller must allocate
and provide space not only for the result, but also any temporary
scratch space needed during the computation. Search this list for
itch/scratch for more info. Some of the low-level functions are
already written this way, but a lot of work remains.
2. Register your own allocation functions with GMP, which detect
allocation failures. Then, set up a allocation marker and a setjmp
buffer before each computation which might exhaust memory. On
failure, have the allocation function not return to gmp, instead, it
should deallocate all temporary storage (using the above "marker"),
and longjmp out to abort the computation.
Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.
More information about the gmp-devel