

These logs may contain references to StackOverflow, alongside other messages.

This is subject to change due to upgrades of the SDK. This is a chart of default sizes for the various stack size arguments. NOTE: The maximum stack size for the operating system is controlled by ulimit -s on UNIX and Linux. Where has the format, nn, such as -Xmso512K. If there is an abundance of calls made on the native stack, adjust the native stack size using this generic JVM argument:
JAVA STACK CODE
Java code uses this to process calls made into native libraries, such as JIT or JNI calls. This parameter controls the initial stack size of native (operating system) threads. Where has the format, nn, such as -Xiss2K In most cases, you will not need to change this option. The default for all distributed platforms is 2KB. This is only for distributed platforms (AIX, Linux, Windows)Īdjusts the initial thread stack size that the JVM will start with. The main thread's native size will be set to whichever value is higher. While the -Xss controls the stack size of all threads in native memory, -XX:MainThreadStackSize controls the size of the main thread. This is the only configurable value for all stack sizes however, on HP-UX systems, there is another argument used to control stack size of the main method. On Solaris and HP-UX systems which use the HotSpot JVM, there is no distinction between native and thread stack sizes. Where has the format, nn, such as -Xss512K If you find looping code or large stacks that are all calling Java methods and do not make native calls, try raising the stack size by using the generic JVM argument below: This parameter controls the stack size of Java method calls (non-native) to track the state of variables.

These are adjustable and can be raised to provide more room on the stacks to prevent an overflow. One is for Java code for method calls, and the other is for native C code (on Solaris and HP-UX, only the native stack is utilized). Be careful to not exhaust your physical and heap memory resources.įor every Java thread, there are two stacks that are utilized. Doubling the stack size is suggested as a first step however, every thread that the JVM creates will consume memory. If this does not work, you can adjust the stack sizes. To resolve, increase the native stack size (usually by adjusting the operating system limit for stack size) to accommodate the recursive native calls however, identifying the recursive native calls will help determine the root cause of the stack overflow.Īdjusting the Stack Sizes (Xss and Xmso) options System cores can be used to identify long and possibly recursively looping native thread stacks. It is almost guaranteed that a crash will occur if the native stack runs out of space. Debugging HotSpot failures on the Solaris and HP-UX operating environment.

JIT Problem Determination for IBM SDK 5.0 and 6.0 using -Xjit.
JAVA STACK HOW TO
The documents linked below explain how to debug JIT and HotSpot compiler issues: This can speed up execution time, but as more aggressive optimizations are used, this can inadvertently cause recursion, resulting in stack overflow or crash. The JIT/HotSpot compiler (JIT) is designed to speed up the JVM execution times by compiling method calls. This is especially true if the stack appears to repeat (such as recursive method calls). However if the recursion continues to trigger a stack overflow, the next step is to identify what code is causing the recursion from javacores, thread dumps, or even system core files.Ī thread stack that indicates it's too large to display can be an indicator of stack overflow. Increasing the thread stack size allows for larger thread stacks. JSP or servlets calling itself (usually by executing forward or include to itself) Very large XML documents loaded into the Document Object Model (DOM) Ěn infinite loop that continuously spawns off threads Large thread stacks that appear to repeat The thread stack has a limited size and eventually its space will run out as the thread stack grows without bounds. If an application is performing recursion, the maximum stack size can easily be reached and a Stack Overflow exception is thrown.
