Remove internal data zero initialization
R2026bControl generation of Initialization code for internal work structures, such as block states and block outputs, to zero
Model Configuration Pane: Code Generation / Optimization
Description
The Remove internal data zero initialization parameter specifies whether to generate initialization code for internal work structures, such as block states and block outputs, to zero.
This parameter does not apply to internal work structures that you map to a TLC-based storage class created using the Custom Storage Class Designer.
Settings
on | off- On
Does not generate code that initializes internal work structures to zero.
During startup, standards-compliant C and C++ compilers initialize global data to zero, eliminating the need to include zero initialization code for this data in the generated code. Standards-compliant compilers do not necessarily initialize dynamically allocated data and local variables to zero. Before leaving the Remove internal data zero initialization parameter selected, confirm that your model meets these conditions:
If your compiler is not standards-compliant, confirm that it initializes global data to zero.
If you set the Code Interface packaging to
Reusable function, confirm that data is either statically allocated or that dynamically allocated data is initialized to zero.
Generated code initializes data that you specify in an Initialize Function block, even if you select this parameter.
- Off
Generates code that initializes internal work structures to zero.
Generated code does not initialize data whose storage class has imported scope, unless you specify that data in an Initialize Function block.
If you set the Code interface packaging parameter to
Nonreusable function, by default, Remove internal data
zero initialization is selected.
If you set the Code interface packaging parameter to
Reusable function, by default, Remove internal data
zero initialization is cleared.
If you set the Code interface packaging
parameter to C++ Class, the Remove internal data zero
initialization check box is selected and cannot be changed.
If you set the Code interface packaging parameter to
Reusable function and select the Use dynamic memory allocation for model initialization
parameter, the parameter is cleared.
Recommended Settings
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | On (execution, ROM), No impact (RAM) |
| Safety precaution | No recommendation |
Programmatic Use
Parameter:
RemoveInternalMemoryZeroInit |
| Type: character vector |
Value:
'on' | 'off' |
Default:
'on' |