| MATLAB Application Program Interface | Search  Help Desk |
| mxDestroyArray | Examples See Also |
Free dynamic memory allocated by an mxCreate routine
C Syntax
#include "matrix.h" void mxDestroyArray(mxArray *array_ptr);
Arguments
array_ptrmxArray that you want to free.
Description
mxDestroyArray deallocates the memory occupied by the specified mxArray. mxDestroyArray not only deallocates the memory occupied by the mxArray's characteristics fields (such as m and n), but also deallocates all the mxArray's associated data arrays (such as pr, pi, ir, and/or jc). You should not call mxDestroyArray on an mxArray you are returning on the left-hand side.
Examples
Seesincall.c in the refbook subdirectory of the examples directory.
For additional examples, see mexcallmatlab.c and mexgetarray.c in the mex subdirectory of the examples directory; see mxisclass.c and mxsetallocfcns.c in the mx subdirectory of the examples directory.
See Also
mxCalloc, mxFree, mexMakeArrayPersistent, mexMakeMemoryPersistent