By default, the MP functions use malloc
, realloc
, and
free
for memory allocation. If malloc
or realloc
fails,
the MP library terminates execution after printing a fatal error message to
standard error.
For some applications, you may wish to allocate memory in other ways, or you may not want to have a fatal error when there is no more memory available. To accomplish this, you can specify alternative memory allocation functions.
Make sure to call this function in such a way that there are no active MP objects that were allocated using the previously active allocation function! Usually, that means that you have to call this function before any other MP function.
The functions you supply should fit the following declarations:
You can assume that the space at ptr was formerly returned from
allocate_function
or reallocate_function
, for a request for
old_size storage units.
You can assume that the space at ptr was formerly returned from
allocate_function
or reallocate_function
, for a request for
size storage units.
(A storage unit is the unit in which the sizeof
operator returns
the size of an object, normally an 8 bit byte.)
Go to the first, previous, next, last section, table of contents.