Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

kapt An exception occurred: java.lang.OutOfMemoryError: GC overhead limit exceeded

I am facing this issue where while building my code I am getting this exception. I have tried increasing the heap space in both build.gradle and Manifest file but none of them seems to be working. I have also changed the gradle properties but that hasn't worked as well.

What I think is issue according to me is that I am using databinding and room and somehow while generating files for same it happens to give this exception.

e: [kapt] An exception occurred: java.lang.OutOfMemoryError: GC overhead limit exceeded
at com.google.googlejavaformat.Doc$State.withColumn(Doc.java:81)
at com.google.googlejavaformat.Doc$Token.computeBreaks(Doc.java:486)
at com.google.googlejavaformat.Doc$Level.computeSplit(Doc.java:330)
at com.google.googlejavaformat.Doc$Level.computeBreakAndSplit(Doc.java:320)
at com.google.googlejavaformat.Doc$Level.computeBroken(Doc.java:296)
at com.google.googlejavaformat.Doc$Level.computeBreaks(Doc.java:266)
at com.google.googlejavaformat.Doc$Level.computeSplit(Doc.java:330)
at com.google.googlejavaformat.Doc$Level.computeBreakAndSplit(Doc.java:320)
at com.google.googlejavaformat.Doc$Level.computeBroken(Doc.java:290)
at com.google.googlejavaformat.Doc$Level.computeBreaks(Doc.java:266)
at com.google.googlejavaformat.Doc$Level.computeSplit(Doc.java:330)
at com.google.googlejavaformat.Doc$Level.computeBreakAndSplit(Doc.java:320)
at com.google.googlejavaformat.Doc$Level.computeBroken(Doc.java:296)
at com.google.googlejavaformat.Doc$Level.computeBreaks(Doc.java:266)
at com.google.googlejavaformat.Doc$Level.computeSplit(Doc.java:330)
at com.google.googlejavaformat.Doc$Level.computeBreakAndSplit(Doc.java:320)
at com.google.googlejavaformat.Doc$Level.computeBroken(Doc.java:290)
at com.google.googlejavaformat.Doc$Level.computeBreaks(Doc.java:266)
at com.google.googlejavaformat.Doc$Level.computeSplit(Doc.java:330)
at com.google.googlejavaformat.Doc$Level.computeBreakAndSplit(Doc.java:320)
at com.google.googlejavaformat.Doc$Level.computeBroken(Doc.java:296)
at com.google.googlejavaformat.Doc$Level.computeBreaks(Doc.java:266)
at com.google.googlejavaformat.Doc$Level.computeSplit(Doc.java:330)
at com.google.googlejavaformat.Doc$Level.computeBreakAndSplit(Doc.java:320)
at com.google.googlejavaformat.Doc$Level.computeBroken(Doc.java:290)
at com.google.googlejavaformat.Doc$Level.computeBreaks(Doc.java:266)
at com.google.googlejavaformat.Doc$Level.computeSplit(Doc.java:330)
at com.google.googlejavaformat.Doc$Level.computeBreakAndSplit(Doc.java:320)
at com.google.googlejavaformat.Doc$Level.computeBroken(Doc.java:296)
at com.google.googlejavaformat.Doc$Level.computeBreaks(Doc.java:266)
at com.google.googlejavaformat.java.Formatter.format(Formatter.java:181)
at com.google.googlejavaformat.java.Formatter.getFormatReplacements(Formatter.java:245)



:app:kaptDebugKotlin FAILED

  FAILURE: Build failed with an exception.

  * What went wrong:
Execution failed for task ':app:kaptDebugKotlin'.
> Compilation error. See log for more details

  * Try:
   Run with --stacktrace option to get the stack trace. Run with --info or - -debug option to get more log output. Run with --scan to get full insights.

  * Get more help at https://help.gradle.org

  BUILD FAILED in 5m 7s
like image 834
Sandip Avatar asked Oct 04 '18 07:10

Sandip


People also ask

What is GC overhead limit?

GC Overhead Limit Exceeded Error It's thrown by the JVM when it encounters a problem related to utilizing resources. More specifically, the error occurs when the JVM spent too much time performing Garbage Collection and was only able to reclaim very little heap space.

How do I fix GC overhead limit exceeded in eclipse?

From the root of the Eclipse folder open the eclipse. ini and change the default maximum heap size of -Xmx256m to -Xmx1024m on the last line. NOTE: If there is a lot of memory available on the machine, you can also try using -Xmx2048m as the maximum heap size.

How can we avoid GC overhead limit exceeded error in Talend?

"GC overhead limit exceeded" message is something which cannot be truly removed by increasing the available memory. Rather GC should be put into a different mode (perhaps event different than suggested by me) to handle the situation properly.


1 Answers

Following gradle settings worked for me.

-Xms256m -Xmx4096m -XX:MaxPermSize=350m -XX:ReservedCodeCacheSize=225m -XX:+UseCompressedOops

This goes in your settings.gradle file as the value for the org.gradle.jvargs parameter, e.g.

org.gradle.jvmargs=-Xms2560m -Xmx4096m -XX:MaxPermSize=350m -XX:ReservedCodeCacheSize=225m -XX:+UseCompressedOops

put line

org.gradle.jvmargs=-Xms2560m -Xmx4096m -XX:MaxPermSize=350m -XX:ReservedCodeCacheSize=225m -XX:+UseCompressedOops

to your gradle.properties (Project Properties)

like image 75
Manuj Jagga Avatar answered Sep 18 '22 00:09

Manuj Jagga