Recursion related question

If the recursive call is inside a loop, you cannot use tail recursion optimization. But you should not be getting stack overflow if the call depth represents the number of Sudoku moves. Either your stack is fairly small and you want to increase it, or probably there is a bug.