Java: Stackoverflow in finite recursion
2 answers
While you can resize the stack as per Oli's answer, I would encourage you to try and find an alternative approach that is not as deeply recursive. For example, you might want to create a stack or a "results so far" queue or something else to simulate recursion, but using empty space instead of using stack space. Increasing the VM stack size always strikes me as a "solution" that delays the problem a bit.
(This also means that if you end the stack trace, they will be monstrous ... whereas if you use the appropriate diagnostics for the "things you are looking at" stack, you can end up with data diagnostics instead of units based on stack frames. )
+1
source to share