Troubleshooting
Problem
In the Java™ SDK shipped for AIX®, Linux® and Windows®, the mark stack is created during the first phase of garbage collection when live objects are marked for retention. Objects are taken off the stack and any references held by the object are added. Mark stack overflow in itself does not indicate an error condition, but it does result in increased CPU utilization.
Cause
Mark stack overflow can be caused because the mark stack is finite.
Resolving The Problem
There is no way to totally avoid a mark stack overflow if you have deep, wide object trees. The following suggestions are not guaranteed to avoid mark stack overflow:
Reducing the Java maximum heap size or the number of objects allocated might help. Any mark stack overflow results in a scan of the entire Java heap, which is expensive in terms of CPU utilization. So, if heap is not occupied to the full extent, the recommendation is to reduce the Xmx to eliminate or minimize mark stack overflow.
Additionally, adding the following Java Virtual Machine (JVM™) argument might help address mark stack overflows:
-Xgcpolicy:optavgpause |
Increasing the number of CPUs on a system also helps address mark stack overflows by taking advantage of parallel garbage collection through gc helper threads. On a system with n processors, the default setting for -Xgcthreads is n - 1 when in resettable mode and n when not in resettable mode. This option sets the number of helper threads that the Garbage Collector uses for concurrent operations.
For more information on mark stack overflows, refer to the IBM Developer Kit and Runtime Environment Java 2 Technology Edition Diagnostics Guide.
Was this topic helpful?
Document Information
Modified date:
15 June 2018
UID
swg21164724