allocation functions

Kevin Ryde user42@zip.com.au
Wed, 18 Dec 2002 16:53:12 +1000


Paul.Zimmermann@loria.fr (Paul Zimmermann) writes:
>
> 1) the functions allocate_function, reallocate_function, deallocate_function
>    from the manual are not in gmp.h. Are those only fake functions?

Yes, the pointers __gmp_allocate_function etc should be used.

I fixed the manual a while ago to get those allocate_function etc out
of the index, but they're still in the custom memory section to show
what an application needs to provide.

> 2) when using mpz_get_str, the returned string is allocated using the current
>    gmp allocation function, so one would like to free it using the current
>    gmp free function, but there it is not documented (see 1).

If an application has set the functions then presumably it knows what
they are :-).

Perhaps an mp_get_memory_functions would be worthwhile though.

> 3) a function mp_reset_memory_functions() would be nice, that would reset
>    to the default functions

You can pass NULL to get that.