allocation functions

Torbjorn Granlund tege@swox.com
18 Dec 2002 11:25:30 +0100


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?
  
Hidden, internal variables.

Kevin Ryde <user42@zip.com.au> writes:

  Yes, the pointers __gmp_allocate_function etc should be used.

Should they?  I think these were for internal use only.

In the future, non-documented GMP names might not be
accessible from user code.  I hope to use features of
archive formats and shared lib format that to do that.
(Actually, my main goal is to speed internal accesses,
vy supporessing PLT stuff, etc.)

  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).
  
I think this is a minor flaw in the GMP interface.

The proper way of freeing things now is to call `free', as
it is documented as the default function.

If a user have changed the functions, by means of
mp_set_memory_functions, the supplied `free' functions must
be used.

-- 
Torbjörn