You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We should either try out static analysis tools like StackAnalyzer (unfortunately only 30-day free trial), or measure it, e.g., by filling the stack with magic numbers and then at the "end of the program" check how many magic numbers survived.
According to a discussion with @danielschloms on Slack, Rodos provides Thread::getMaxStackUsage(). This uses the approach where the stack is initially "painted" with magic numbers and you can later check how much "paint" is left.
Now, all that is left to do is use this function an estimate the max. stack size for all our threads.
As it turns out, it is even easier than that. I recently ran some tests where Rodos printed an error message telling me that there is a stack overflow in a thread and therefore terminated it. This worked on both Linux and the COBC and allowed me to binary search for the minimum required stack size. I only tested this with debug builds, though. Also, note that sometimes the error message was not printed. Instead, the output on HTerm just stopped at random locations. Knowing this should allow us to easily determine if a stack overflow occurred by just running the code in debug mode and checking the printed output, which is very nice.
Description
Current stack size estimations are very crude guesses. We only have 128 kB of RAM.
Files
All threads files.
The text was updated successfully, but these errors were encountered: