LinuxHelps.com

A blog for Linux Lovers.

Posted by sibu on March 13, 2015

GC overhead limit exceeded ….!!!

java.lang.OutOfMemoryError: GC overhead limit exceeded

All Java applications include a built-in Garbage Collection (GC). In many other programming languages, the developers need to manually allocate and free memory regions so that the freed memory can be reused. Java applications on the other hand only need to allocate memory. Whenever a particular space in memory is no longer used a separate process called Garbage Collection clears the memory for you.

The “java.lang.OutOfMemoryError: GC overhead limit exceeded” error means that GC has been trying to free the memory but is pretty much unable to get any job done. By default it happens when the JVM is spending more than 98% of the total time in GC. In addition, after GC less than 2% of the heap is recovered.

So – the “java.lang.OutOfMemoryError: GC overhead limit exceeded” error will be displayed when your application has exhausted pretty much all the available memory and GC has repeatedly failed to clean it.
Cause of java.lang.OutOfMemoryError

When failing with the “java.lang.OutOfMemoryError: GC overhead limit exceeded” error, the JVM is signalling that your application is spending too much time in garbage collection with little to show for it. By default the JVM is configured to throw this error if you are spending more than 98% of the total time in GC and after the GC less than 2% of the heap is recovered.

What would happen if this GC overhead limit was not present?  Note that the “GC overhead limit exceeded” error is thrown only when 2% of the memory was freed after several GC cycles.

This means that the little amount GC was able to clean will be quickly filled again thus forcing GC to restart the cleaning process again.This forms a vicious cycle where the CPU is 100% busy with GC and no actual work can be done. End users of the application are facing extreme slowdowns – operations which used to be completed in milliseconds are now likely to take minutes to finish.

Comments are closed.