Java application "java.lang.OutOfMemoryError: GC overhead limit exceeded"

Solution Verified - Updated

Environment

  • Java
  • OpenJDK
  • Oracle JDK

Issue

  • The following error appears in the server log (e.g. JBoss server.log):
ERROR [STDERR] java.lang.OutOfMemoryError: GC overhead limit exceeded
  • We would like to root cause analysis of the heap dump generated by one of our application (GRCC) and would like to get some recommendation on heap size parameter setting.

Resolution

  • If the new generation size is explicitly defined with JVM options, decrease the size or remove the relevant JVM options entirely to unconstrain the JVM and provide more space in the old generation for long lived objects.
  • If there is unintended object retention, typically code and/or configuration changes are needed.
  • If the retention looks normal, and it is a load issue, the heap size would need to be increased.

Root Cause

Diagnostic Steps

  • Note: Sometimes this type of OutOfMemoryError does not result in a heap dump when the -XX:+HeapDumpOnOutOfMemoryError option is used. In those cases it will be necessary to get a heap dump manually.
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.