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.
... // Finally - Terminate the simulator and clean up. SIM_TERMINATE; DELETE_SIMS; MEM_DELETE(a); MEM_DELETE(b); } // End try block // Start catch block catch(MOTDSP_Exception &exc) { DELETE_SIMS; MEM_DELETE(a); MEM_DELETE(b); } /* End catch block */
![]() | Exporting Data to MATLAB | Simulink S-Function MEX-Files | ![]() |