Documentation

Adjust the Target Computer Stack Size

To discover and adjust the stack size used by the real-time threads on the target computer:

  1. Add the following blocks to your model:

    • Current Available Stack Size — Outputs the number of bytes of stack memory currently available to the real-time application thread.

    • Minimum Available Stack Size — Outputs the number of bytes that have not been used in the stack since the thread was created.

      The block traverses the entire stack at every time step to find and report unused bytes. Use Minimum Available Stack Size only for diagnostic purposes.

  2. Execute the real-time application, monitoring the stack size and minimal stack size.

  3. Calculate a stack size that allows execution to proceed.

    Target computer memory for the real-time application executable, the kernel, and other uses is limited to a maximum of 4 GB.

  4. Adjust the stack size of the real-time threads by using a TLCOptions setting.

    For example, to set the stack size for real-time application xpcosc to 4096 kBytes, in the MATLAB® Command Window, type:

    set_param('xpcosc','TLCOptions','-axPCModelStackSizeKB=4096')

See Also

| |

Was this topic helpful?