To discover and adjust the stack size used by the real-time threads on the target computer:
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.
Execute the real-time application, monitoring the stack size and minimal stack size.
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.
Adjust the stack size of the real-time threads by using a
For example, to set the stack size for real-time application
in the MATLAB® Command Window, type: