Main Content

Dynamic memory allocation threshold

Size threshold for dynamic memory allocation of variable-size arrays

Description

App Configuration Pane: Memory

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

The Dynamic memory allocation threshold specifies the size threshold for the dynamic allocation of memory for fixed- and variable-size arrays. By default, this threshold applies only to variable-size arrays. To use dynamic memory allocation for fixed-size arrays larger than the size threshold, select the Enable dynamic memory allocation for fixed-sized arrays parameter.

Dynamic memory allocation can reduce the speed of the generated code. Conversely, static memory allocation can lead to unused storage space. If speed is a greater concern than storage space, consider increasing the dynamic memory allocation threshold and statically allocating memory for larger arrays. If storage space is a greater concern than speed, consider decreasing this threshold and dynamically allocating memory for smaller arrays.

Dependencies

To enable this parameter, select the Enable dynamic memory allocation check box.

Settings

65536 | positive integer

Threshold for dynamic memory allocation in bytes, specified as a positive integer. The default setting is 65536 (64 kilobytes).

Programmatic Use

Property: DynamicMemoryAllocationThreshold
Values: 65536 | positive integer
Default: 65536

Version History

Introduced in R2012a