C++ Math Library Reference | ![]() ![]() |
Set memory management functions for MATLAB C++ Math Library
C++ Prototype
void mwSetLibraryAllocFcns( mwMemCallocFunc callocProc, mwMemFreeFunc freeProc, mwMemReallocFunc reallocProc, mwMemAllocFunc mallocproc, mwMemCompactFunc=0);
Arguments
callocProc
A pointer to a function that allocates memory. mwMemCallocFunc is defined as:
typedef voidfreeProc*
(*
mwMemCallocFunc)(size_t, size_t);
typedef void (reallocProc*
mwMemFreeFunc)(void*
);
typedef voidmallocproc*
(*
mwMemReallocFunc)(void *, size_t);
typedef voidcompactproc*
(*
mwMemAllocFunc)(size_t);
Description
Sets the MATLAB C++ Math Library's memory management functions. Gives you complete control over memory management.
To set up your own memory management routines, you need to write four routines: two memory allocation routines, one memory reallocation routine, and one deallocation routine. You then call mwSetLibraryAllocFcns()
to register those routines with the library.
You cannot omit any of the four routines. However, the last argument to mwSetLibraryAllocFcns()
, m
wMemCompactFunc, is not currently used and is therefore initialized to zero. When you call mwSetLibraryAllocFcns()
, you do not need to specify a value for it.
![]() | mwSetExceptionMsgHandler | mwSetPrintHandler | ![]() |