MATLAB Application Program Interface
  Go to function:
    Search    Help Desk 
mexMakeMemoryPersistent    See Also

Make memory allocated by MATLAB's memory allocation routines (mxCalloc, mxMalloc, mxRealloc) persist after the MEX-file completes

C Syntax

Arguments

ptr
  Pointer to the beginning of memory allocated by one of MATLAB's memory allocation routines.

Description

By default, memory allocated by MATLAB is nonpersistent, so it is freed automatically when the MEX-file finishes. If you want the memory to persist, you must call mexMakeMemoryPersistent.

Note:  If you create persistent memory, you are responsible for freeing it when the MEX-file is cleared. If you do not free the memory, MATLAB will leak memory. To free memory, use mxFree. 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.

See Also

mexAtExit, mexLock, mexMakeArrayPersistent, mxCalloc, mxFree, mxMalloc, mxRealloc



[ Previous | Help Desk | Next ]