Using the C Math Library    

Restrictions 

Routines that use the MATLAB C Math Library's automated memory management can only call other routines written with automated memory management. This includes any of the MATLAB C Math Library Version 2.0 functions.

Routines that use automated memory management cannot call functions that use explicit memory management, for example, routines written with the MATLAB C Math Library prior to Version 2.0.

If you write a new function that does not use the library's automated memory management, you can:

Recommendation

Though the explicit approach seems to offer flexibility, you lose the benefits of the library's automated memory management.

Mixing memory management styles is not recommended. Choose one style or the other. Use the mlfEnterNewContext() and mlfRestorePreviousContext() pair and mlfAssign() for all your functions or none of your functions.


 Example Without Automated Memory Management Replacing Allocation and Deallocation Routines