I have an algorithm that uses deep recursion. How many levels deep the recursion will go varies and depends on the input. To avoid stack overflow exceptions I keep count of the depth and terminate at a specific depth.
By a bit of experimentation I previously established that a level of 500 was the point at which to stop. However, now suddenly I get stack overflow exceptions at levels just over 300.
Can anyone shed a bit of light on which factors would affect this? Is it e.g. CPU and RAM? Or related to which other processes is running on the computer?