Memory Usage
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.
Topics
- Vector Operation OptimizationThe code generator reduces stack memory by replacing temporary local arrays with local variables. 
- Reduce Memory Usage for Boolean and State Configuration VariablesReduce the amount of memory that stores state configuration variables and Booleanvariables.
- Optimize Generated Code Using memset FunctionThe memsetfunction clears internal storage, regardless of type, to the integer bit pattern 0 (that is, all bits are off).
- Customize Stack Space AllocationControl the maximum allowable stack size to provide some control over whether data is defined locally or globally in the generated code. 
- Configure Loop Unrolling ThresholdStarting at a default value of 5, the code generator begins to use a forloop instead of separate statements to assign values to the elements of a signal or parameter array.
- Specify Single-Precision Data Type for Embedded ApplicationGenerate code whose floating-point data types are only single precision, for example, for targeting a single-precision processor. 
- Generate Efficient Code by Specifying Data Types for Block ParametersTo generate more efficient code, match parameter data types with signal data types or store parameters in smaller data types. 
- Optimize Generated Code Using Boolean Data for Logical SignalsThe code generator optimizes the generated code by storing logical signals as Booleandata types.
- Optimize Memory Usage for Time CountersOptimize memory that the code generator allocates for an elapsed time counter.