java.lang.OutOfMemoryError: GC overhead limit exceeded Error

0 votes

Can someone explain what is “GC overhead limit” in the below error:

java.lang.OutOfMemoryError: GC overhead limit exceeded

Also, please do explain how to get rid of it. Thanks in advance.

May 31, 2018 in Java by anto.trigg4
• 3,440 points

1 answer to this question.

0 votes

This simply means that for some reason garbage collector is consuming an excessive amount of time. For example, 98% of CPU time is spent on GC and less than 2% of the heap is recovered. This technically means your program stops making any progress and just executes the garbage collector. Thus in order to let you diagnose this error and prevent the applications from running for an extended period, JVM throws this error.

You can prevent this error, by following any of the below:

  1. Increasing the heap size, for e.g: -Xmx1g

  2. Enabling the concurrent low pause collector -XX:+UseConcMarkSweepGC

  3. Reusing the existing objects when possible to save some memory

Hope this helps!!

answered May 31, 2018 by misc.edu04
• 1,430 points

Related Questions In Java

0 votes
1 answer

Following error is occurring "Can't start Eclipse - Java was started but returned exit code=13"

There are combinations of Operating System, JDK ...READ MORE

answered Apr 19, 2018 in Java by Rishabh
• 3,580 points
0 votes
2 answers

How can I solve java.lang.NoClassDefFoundError in Java?

NoClassDefFoundError means that the class is present ...READ MORE

answered Sep 11, 2018 in Java by Sushmita
• 6,890 points
0 votes
1 answer

Fixing java.lang.UnsupportedClassVersionError in Java

To fix the exception/ error, you should ...READ MORE

answered Jun 7, 2018 in Java by sharth
• 3,370 points
+1 vote
1 answer

How to fix java.lang.UnsupportedClassVersionError: Unsupported major.minor version

This error means you're trying to load ...READ MORE

answered Jun 8, 2018 in Java by Rishabh
• 3,580 points
0 votes
1 answer

What causes java.lang.reflect.InvocationTargetException

The exception is thrown if InvocationTargetException - if ...READ MORE

answered Jun 19, 2018 in Java by Rishabh
• 3,580 points
0 votes
1 answer

How to prevent java.lang.NumberFormatException in Java?

"N/A" is not integer. It must throw NumberFormatException if you ...READ MORE

answered Jun 26, 2018 in Java by sharth
• 3,370 points
+1 vote
1 answer

How can we resolve java.lang.OutOfMemoryError in Java?

Work with smaller batches of HashMap Objects ...READ MORE

answered Jun 5, 2018 in Java by sharth
• 3,370 points
0 votes
0 answers
0 votes
1 answer

Is it possible to create a memory leak with Java

Here's a good way to create a memory ...READ MORE

answered May 30, 2018 in Java by Parth
• 4,640 points
+9 votes
12 answers

Default parameters of XMS and XMX in JVM

You use these Java command-line parameters to ...READ MORE

answered Nov 13, 2018 in Java by Murali