Main Content

Memory Usage

Optimize use of RAM, ROM, and stack space by generated code

Control memory consumption by specifying whether the code generator defines variables locally or globally and how data passes to subsystem functions. Modify configuration settings to reduce the amount of memory for storing data.

The code generator reduces ROM consumption by combining control flow constructs, removing dead code paths and code for blocks that do not have an impact on computational results. You can further reduce ROM consumption by removing code that you might not need such as initialization code, the reset and disable functions, and defensive code.


expand all

coder.profile.ExecutionStackSetAggregate stack usage profiling results from multiple SIL, PIL, or external mode simulations (Since R2023b)


expand all

addAggregate stack usage profiles (Since R2023b)
getExtract specific stack usage profile from aggregate of profiles (Since R2023b)
removeRemove stack usage profile from aggregate of profiles (Since R2023b)


Define Variables Locally or Globally

Reduce Code Size

Reduce Memory for Storing Data

Analyze Stack Usage