Tuesday, August 20, 2013

What is 'java.lang.OutOfMemoryError: GC overhead limit exceeded'

The Garbage Collector in JVM throws this exception when too much time is spent in garbage collection for too little return. e.g. 98% of CPU time is spent on GC and less than 2% of heap is recovered.


This effectively means that your program stops doing any progress and is busy running only the garbage collection at all time.
To prevent your application from consuming up CPU time without getting anything done, the JVM throws thisError so that you have a chance of diagnosing the problem.

Solution
  1. Increase the heap size using -Xmx option, for example -Xmx1g.
  2. Enable the concurrent low pause collector -XX:+UseConcMarkSweepGC.
  3. Reuse existing objects when possible to save some memory.
If necessary, the limit check can be disabled by adding the option -XX:-UseGCOverheadLimit to the command line although this is not advised.
For more details please check this article

No comments:

Post a Comment