Troubleshoot Target Computer Stack Size

I want to find the optimum amount of target computer memory to use for the stack.

What This Issue Means

The stack size on the target computer affects real-time application performance. For some applications, it is important to analyze the current available stack size and minimum available stack size, so that you can adjust the stack size for the application.

Try This Workaround

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

  1. Add these 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:


See Also

| |