Next: , Previous: , Up: MPFR Interface   [Index]


5.14 Memory Handling Functions

These are general functions concerning memory handling (see Memory Handling, for more information).

Function: void mpfr_free_cache (void)

Free all caches and pools used by MPFR internally (those local to the current thread and those shared by all threads). You should call this function before terminating a thread, even if you did not call mpfr_const_* functions directly (they could have been called internally).

Function: void mpfr_free_cache2 (mpfr_free_cache_t way)

Free various caches and pools used by MPFR internally, as specified by way, which is a set of flags:

  • those local to the current thread if flag MPFR_FREE_LOCAL_CACHE is set;
  • those shared by all threads if flag MPFR_FREE_GLOBAL_CACHE is set.

The other bits of way are currently ignored and are reserved for future use; they should be zero.

Note: mpfr_free_cache2 (MPFR_FREE_LOCAL_CACHE | MPFR_FREE_GLOBAL_CACHE) is currently equivalent to mpfr_free_cache().

Function: void mpfr_free_pool (void)

Free the pools used by MPFR internally. Note: This function is automatically called after the thread-local caches are freed (with mpfr_free_cache or mpfr_free_cache2).

Function: int mpfr_mp_memory_cleanup (void)

This function should be called before calling mp_set_memory_functions. See Memory Handling, for more information. Zero is returned in case of success, non-zero in case of error. Errors are currently not possible, but checking the return value is recommended for future compatibility.