Created
July 8, 2019 09:40
-
-
Save ezhov-da/3ed5137c9b1301dd977341c45179caf9 to your computer and use it in GitHub Desktop.
StackOverflowError
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
==> https://examples.javacodegeeks.com/java-basics/exceptions/java-lang-stackoverflowerror-how-to-solve-stackoverflowerror/ | |
How to deal with the StackOverflowError | |
The simplest solution is to carefully inspect the stack trace and detect the repeating pattern of line numbers. These line numbers indicate the code being recursively called. Once you detect these lines, you must carefully inspect your code and understand why the recursion never terminates. | |
If you have verified that the recursion is implemented correctly, you can increase the stack’s size, in order to allow a larger number of invocations. Depending on the Java Virtual Machine (JVM) installed, the default thread stack size may equal to either 512KB, or 1MB. You can increase the thread stack size using the -Xss flag. This flag can be specified either via the project’s configuration, or via the command line. The format of the -Xss argument is: | |
-Xss<size>[g|G|m|M|k|K] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment