Maximum stack size (bytes)

Description

Specify the maximum stack size in bytes for your model.

Category: Optimization

Settings

Default:Inherit from target

Inherit from target

The Simulink® Coder™ software assigns the maximum stack size to the smaller value of the following:

  • The default value (200,000 bytes) set by the Simulink Coder software

  • Value of the TLC variable MaxStackSize in the system target file

<Specify a value>

Specify a positive integer value. Simulink Coder software assigns the maximum stack size to the specified value.

Note

If you specify a maximum stack size for a model, the estimated required stack size of a referenced model must be less than the specified maximum stack size of the parent model.

Tips

  • If you specify the maximum stack size to be zero, then the generated code implements all variables as global data.

  • If you specify the maximum stack to be inf, then the generated code contains the least number of global variables.

  • If your model contains a variable that is larger than 4096 bytes, the code generator implements it in global memory by default. You can increase the size of variables that the code generator places in local memory by changing the value of the TLC variable MaxStackVariableSize. You can change this value by typing the following command in MATLAB Command Window:
    set_param(modelName,'TLCOptions','-aMaxStackVariableSize=N')

Command-Line Information

Parameter: MaxStackSize
Type: int
Value: valid value
Default: Inherit from target

Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precautionNo impact

Related Topics