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
3,873 views

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,450 points

Related Questions In Java

0 votes
0 answers

Error java.lang.OutOfMemoryError: GC overhead limit exceeded

When I execute my JUnit tests I am getting ...READ MORE

May 15, 2022 in Java by Kichu
• 19,050 points
141 views
0 votes
1 answer

Error:“java.lang.OutOfMemoryError: Java heap space” ?

Hii, Possible causes: Simple configuration issue, where the specified ...READ MORE

answered Apr 8, 2020 in Java by Niroj
• 82,840 points
612 views
0 votes
1 answer

Error:“java.lang.OutOfMemoryError: PermGen space” in Maven build

Hello @kartik, When you increased MAVEN_OPTS, you increase the MaxPermSize, ...READ MORE

answered Jun 3, 2020 in Java by Niroj
• 82,840 points
944 views
0 votes
1 answer

Error:java.lang.OutOfMemoryError: Java heap space in Maven

Hello @kartik, Here is the whole config that ...READ MORE

answered Jun 3, 2020 in Java by Niroj
• 82,840 points
8,577 views
0 votes
1 answer
0 votes
0 answers

Exception in thread "main" java.lang.Error: Unresolved compilation problems

I am facing issues importing classes and ...READ MORE

May 7, 2022 in Java by narikkadan
• 53,920 points
2,621 views
+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,350 points
581 views
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 31, 2018 in Java by Parth
• 4,630 points
1,782 views
+10 votes
13 answers

Default parameters of XMS and XMX in JVM

Run this code to see all the ...READ MORE

answered Nov 13, 2018 in Java by anonymous
351,868 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP