| MATLAB® | ![]() |
#include "mex.h" void mexMakeArrayPersistent(mxArray *pm);
mexMakeArrayPersistent(pm) mwPointer pm
Pointer to an mxArray created by an mxCreate* function
By default, an mxArrayallocated by an mxCreate* function is not persistent. The MATLAB memory management facility automatically frees a nonpersistent mxArray when the MEX-function finishes. If you want the mxArray to persist through multiple invocations of the MEX-function, you must call the mexMakeArrayPersistent function.
Note If you create a persistent mxArray, you are responsible for destroying it using mxDestroyArray when the MEX-file is cleared. If you do not destroy a persistent mxArray, MATLAB leaks memory. See mexAtExit to see how to register a function that gets called when the MEX-file is cleared. See mexLock to see how to lock your MEX-file so that it is never cleared. |
mexAtExit, mxDestroyArray, mexLock, mexMakeMemoryPersistent, and the mxCreate* functions
![]() | mexLock (C and Fortran) | mexMakeMemoryPersistent (C and Fortran) | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |