Dynamic memory allocation interface
Dynamically allocated array at generated function interface
Description
App Configuration Pane: Memory
Configuration Objects: coder.MexCodeConfig | coder.CodeConfig | coder.EmbeddedCodeConfig
The Dynamic memory allocation interface parameter controls the implementation of dynamically allocated arrays at the interface of generated C++ functions. Select whether to implement dynamically allocated arrays by using:
C-style
emxArraydata structuresC++
coder::arrayclass templates
When using the MATLAB®
Coder™ app, by default, the code generator uses the Determine
dynamic memory allocation interface based on language setting. If the
Language parameter is C, this
parameter is disabled and the code generator uses C-style emxArray
data structures.
When using the GPU Coder™ app, by default, the code generator uses C-style
emxArray data structures.
Note
If you are using the GPU Coder app, if the Malloc
mode (GPU Coder) parameter is set to unified, the
code generator ignores this parameter and uses the C-style
emxArray data structure.
Dependencies
To enable this parameter:
Select the Enable variable-sizing check box.
Set the Language parameter to
C++.
Settings
Determine dynamic memory allocation interface based on languageWhen using the MATLAB Coder app, this is the default value. The code generator implements dynamically allocated arrays depending on the Language parameter.
Use C style EmxArrayWhen using the GPU Coder app, this is the default value. The code generator uses the C-style
emxArraydata structure to implement dynamically allocated arrays.Use C++ coder::arrayThe code generator uses the
coder::arrayclass template to implement dynamically allocated arrays.If you generate GPU code, the code generator also uses the
coder::gpu_arrayclass template to access memory on the GPU. For more information, see Use Dynamically Allocated C++ Arrays in Generated Function Interfaces (GPU Coder).
Programmatic Use
Property:
DynamicMemoryAllocationInterface |
Values: "Auto" |
"C" | "C++" |
Version History
Introduced in R2020a