Dynamic memory allocation in MATLAB functions
Use dynamic memory allocation (malloc) for variable-size arrays whose size (in bytes) is greater than or equal to the dynamic memory allocation threshold. This parameter applies to MATLAB® code in a MATLAB Function block, a Stateflow® chart, or a System object™ associated with a MATLAB System block. This parameter applies to the model during simulation and code generation. This parameter does not apply to:
Input or output signals
Discrete state properties of System objects associated with a MATLAB System block
Category: Simulation Target > Advanced parameters
Default: On (for GRT-based targets) | Off (for ERT-based targets)
Enables dynamic memory allocation.
Disables dynamic memory allocation.
Enables the Dynamic memory allocation threshold in MATLAB functions parameter.
Code that uses dynamic memory allocation can be less efficient than code that uses static memory allocation. Unless your model requires dynamic memory allocation, consider clearing this check box.
If sufficient memory is not available to satisfy a memory allocation request, dynamic memory allocation can fail. The code generator does not check memory allocation requirements. For safety-critical systems, the recommended setting for this parameter is