Contenido principal

Generate re-entrant code

Multi-instance, reentrant code

Description

App Configuration Pane: Memory

Configuration Objects: coder.CodeConfig | coder.EmbeddedCodeConfig

The Generate re-entrant code parameter specifies whether the code generator produces reusable, multi-instance code that is reentrant.

Generate reentrant code when you want to:

  • Deploy your code in multi-threaded environments.

  • Share the same algorithm with different persistent data.

  • Use function variables in the generated code that are too large to fit on the stack.

By default, the code generator does not generate reentrant, multi-instance code. Instead, it statically allocates memory for global variables, persistent variables, and function variables that are too large to fit on the stack. Because the code generator allocates memory for these variables statically, you cannot deploy the generated code in environments that require code to be reentrant. In addition, the generated code can cause static memory size overflow if you cannot adjust the static memory allocation size to accommodate the static memory requirements of the program.

If you choose to enable reentrant, multi-instance code, the code generator creates input data structures for global variables, persistent variables, and function variables that are too large to fit on the stack. The code generator dynamically allocates memory for these input structures. Because the generated code allocates memory dynamically, you can deploy the generated code in reentrant environments.

This parameter is not supported by the GPU Coder™ product.

Settings

Off

The code generator does not produce multi-instance, reentrant code. This value is the default value.

On

The code generator produces reusable, multi-instance code that is reentrant.

Programmatic Use

Property: MultiInstanceCode
Values: false | true
Default: false

Version History

Introduced in R2011a