I want to find the optimum amount of target computer memory to use for the stack.
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.
To discover and adjust the stack size used by the real-time threads on the target computer:
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.
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
4096 kBytes, in the
MATLAB® Command Window,