| MATLAB Application Program Interface Reference | Help Desk |
mexMakeMemoryPersistent
Make a section of dynamic memory allocated bymxCalloc persist after the MEX-file completes
#include "mex.h" void mexMakeMemoryPersistent(void *ptr);ptr
Pointer to the beginning of any memory parcel allocated by mxCalloc.
mxCalloc is nonpersistent. That is, MATLAB's memory management facility automatically frees such memory when the MEX-file finishes. Calling mexMakeMemoryPersistent tells MATLAB not to free such memory when the MEX-file finishes. In other words, the memory allocated by mxCalloc becomes persistent.
mexLock, mexMakeArrayPersistent, mxCalloc