External Interfaces/API | ![]() ![]() |
Memory Management
As of Version 5.2, MATLAB now implicitly destroys (by calling mxDestroyArray
) any arrays created by a MEX-file that are not returned in the left-hand side list (plhs()
). Consequently, any misconstructed arrays left over at the end of a MEX-file's execution have the potential to cause memory errors.
In general, we recommend that MEX-files destroy their own temporary arrays and clean up their own temporary memory. For additional information on memory management techniques, see the Memory Management section under Creating C Language MEX-Files and the Memory Management Compatibility Issues section under Calling C and Fortran Programs from MATLAB.
![]() | Advanced Topics | Debugging Fortran Language MEX-Files | ![]() |