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
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.
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.
"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.
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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With