Main Content

Enable dynamic memory allocation

Enable dynamic memory allocation for variable-size arrays

Since R2023a

Description

App Configuration Pane: Memory

Configuration Objects: coder.MexCodeConfig | coder.CodeConfig | coder.EmbeddedCodeConfig

Control use of dynamic memory allocation for variable-size data. By default, dynamic memory allocation is enabled for variable-size arrays whose size (in bytes) is greater than or equal to theDynamic memory allocation threshold and the code generator allocates memory for this variable-size data dynamically on the heap.

You must use dynamic memory allocation for unbounded variable-size data.

Dependencies

Selecting this parameter enables the parameters Enable dynamic memory allocation for fixed-sized arrays and Dynamic memory allocation threshold.

Settings

On

This value is the default value.

The code generator allocates memory dynamically on the heap for variable-size arrays whose size (in bytes) is greater than or equal to the Dynamic memory allocation threshold.

Off

The code generator statically allocates memory for variable-size arrays on the stack.

Programmatic Use

Property: EnableDynamicMemoryAllocation
Values: true | false
Default: true

Version History

Introduced in R2023a