I'm making a program that has to be ran for a long period of time, therefor the TraceBack builds up until it hits a "stack level too deep (SystemStackError)" error. So my question is how do I clear the TraceBack history in my program so i don't get this SystemStackError?
Asked
Active
Viewed 33 times
0
-
1If you ever need to go back up the stack, you can't clear it because you'll need it. In that case you should increase the limit (https://stackoverflow.com/questions/242617/how-to-increase-stack-size-for-a-ruby-app-recursive-app-getting-stack-level-to). If you don't need to go back up the stack, then your code shouldn't be recursive. Rewrite it to be iterative instead. – Siim Liiser Nov 12 '20 at 17:56
-
2See https://stackoverflow.com/questions/824562/does-ruby-perform-tail-call-optimization if you're intentionally using recursion – max pleaner Nov 12 '20 at 19:13