Motorola DSP Developer's Kit    

Terminating and Allocated Memory Cleanup

Within the unchanged template sections, the Terminate() method of the simulator classes is called to end the simulation. The macro alternative is SIM_TERMINATE.

Use the MEM_DELETE() macro as appropriate to free memory allocated during execution of the MEX-file. Similarly, use the DELETE_SIMS macro to free the simulator class object.

You should use these macros both at the very end of the try block and in all of the exception handling catch blocks of your functions.

For example,


 Exporting Data to MATLAB Simulink S-Function MEX-Files