How to work with StackOverflowError:
The simplest solution is to carefully check the stack trace and detect a duplicate line number pattern. These line numbers indicate that the code is called recursively. When you find these lines, you should carefully check your code and understand why the recursion never ends.
If you have confirmed the implementation of the recursion is correct, you can increase the size of the stacks to allow more calls. Depending on the installed Java Virtual Machine (JVM), the default stack size can be either 512 KB or 1 MB. You can increase the size of the thread stack with the -Xss flag. This flag can be specified either through the configuration of projects, or through the command line. The format of the -Xss
argument -Xss
:
-Xss<size>[g|G|m|M|k|K]
By the way, this seems to be an eclipse bug (read this ref ), which has been fixed in the latest version.
source share