OutOfMemoryError: GC overhead limit exceeded

15,801 views
Skip to first unread message

Martin Liersch

unread,
Oct 25, 2013, 3:10:52 AM10/25/13
to adt...@googlegroups.com
Hey everyone,

I am having a big issue with my biggest project. I added Google Drive to it and now I get

java.lang.OutOfMemoryError: GC overhead limit exceeded

on the dexDebug task.

For Drive I have added these dependencies:

    compile 'com.google.android.gms:play-services:3.2.65'
    compile 'com.google.api-client:google-api-client:1.17.0-rc'
    compile 'com.android.support:support-v4:18.+'
    compile 'com.google.api-client:google-api-client-android:1.17.0-rc'
    compile 'com.google.apis:google-api-services-drive:v2-rev102-1.17.0-rc'
    compile 'com.google.api-client:google-api-client-gson:1.17.0-rc'

I have already tried providing -Xmx2G-XX:-UseGCOverheadLimit and stuff, but it doesn't help...

Do you have any idea how I might solve this? Has my project become too big for Gradle/dx to handle?

Avram Lyon

unread,
Oct 25, 2013, 6:42:59 AM10/25/13
to adt...@googlegroups.com

Add this to your android closure:

    dexOptions {
        incremental true
        javaMaxHeapSize "4g"
    }

This solved all the GC overhead issues for my team, and we have substantially more dependencies. Previously we would see that error on almost every build.


Avram Lyon
Android wrangler | Scopely, Inc.

Refer The Smartest Person You Know And Pocket $5,000! 
Learn more: scopely.com/referrals



--
You received this message because you are subscribed to the Google Groups "adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adt-dev+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Goddchen

unread,
Oct 25, 2013, 6:57:10 AM10/25/13
to adt...@googlegroups.com
Awesome! That's it :) Thanks!


--
Martin "Goddchen" Liersch
> Blog: http://blog.goddchen.de
> Website: http://www.goddchen.de


2013/10/25 Avram Lyon <av...@scopely.com>

--
You received this message because you are subscribed to a topic in the Google Groups "adt-dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/adt-dev/r4p-sBLl7DQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to adt-dev+u...@googlegroups.com.

Luke Daley

unread,
Oct 25, 2013, 4:47:48 AM10/25/13
to adt...@googlegroups.com
Hi,

Can you please run the build with --stacktrace (or -s) and paste the stack.
> --
> You received this message because you are subscribed to the Google Groups "adt-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to adt-dev+u...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

--
Luke Daley
Principal Engineer, Gradleware
http://gradleware.com

Join us at the Gradle eXchange 2013, Oct 28th in London, UK: http://skillsmatter.com/event/java-jee/gradle-exchange-2013

Martin Liersch

unread,
Oct 28, 2013, 11:37:51 AM10/28/13
to adt...@googlegroups.com
Is this what you are looking for?

        UNEXPECTED TOP-LEVEL ERROR:
        java.lang.OutOfMemoryError: GC overhead limit exceeded
                at com.android.dx.ssa.SsaBasicBlock.getRopLabelSuccessorList(SsaBasicBlock.java:393)
                at com.android.dx.ssa.back.SsaToRop.convertBasicBlock(SsaToRop.java:299)
                at com.android.dx.ssa.back.SsaToRop.convertBasicBlocks(SsaToRop.java:260)
                at com.android.dx.ssa.back.SsaToRop.convert(SsaToRop.java:124)
                at com.android.dx.ssa.back.SsaToRop.convertToRopMethod(SsaToRop.java:70)
                at com.android.dx.ssa.Optimizer.optimize(Optimizer.java:102)
                at com.android.dx.ssa.Optimizer.optimize(Optimizer.java:73)
                at com.android.dx.dex.cf.CfTranslator.processMethods(CfTranslator.java:273)
                at com.android.dx.dex.cf.CfTranslator.translate0(CfTranslator.java:134)
                at com.android.dx.dex.cf.CfTranslator.translate(CfTranslator.java:87)
                at com.android.dx.command.dexer.Main.processClass(Main.java:487)
                at com.android.dx.command.dexer.Main.processFileBytes(Main.java:459)
                at com.android.dx.command.dexer.Main.access$400(Main.java:67)
                at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:398)
                at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:245)
                at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:131)
                at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:109)
                at com.android.dx.command.dexer.Main.processOne(Main.java:422)
                at com.android.dx.command.dexer.Main.processAllFiles(Main.java:333)
                at com.android.dx.command.dexer.Main.run(Main.java:209)
                at com.android.dx.command.dexer.Main.main(Main.java:174)
                at com.android.dx.command.Main.main(Main.java:91)

        at com.android.ide.common.internal.CommandLineRunner.runCmdLine(CommandLineRunner.java:98)
        at com.android.ide.common.internal.CommandLineRunner.runCmdLine(CommandLineRunner.java:69)
        at com.android.builder.AndroidBuilder.convertByteCode(AndroidBuilder.java:998)
        at com.android.builder.AndroidBuilder$convertByteCode.call(Unknown Source)
        at com.android.build.gradle.tasks.Dex.doFullTaskAction(Dex.groovy:55)
        at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.groovy:96)
        at org.gradle.util.JavaMethod.invoke(JavaMethod.java:62)
        ... 59 more

Luke Daley

unread,
Nov 1, 2013, 8:39:57 AM11/1/13
to adt...@googlegroups.com
Yes thanks.

I wasn't sure which process was OOM'ing and therefore where to go bump the allocation. The subsequent post to mine listed the solution.

Jigar Mori

unread,
Jan 4, 2016, 6:12:46 PM1/4/16
to adt-dev
yes bro,

Good answer,  Thanks for time saving..

Igor Ganapolsky

unread,
Aug 23, 2016, 1:58:34 PM8/23/16
to adt-dev
This didn't solve anything for me.

Iliya

unread,
Aug 23, 2016, 6:34:18 PM8/23/16
to adt-dev
Try the gradle.properties file mentioned here:

that solved my memory issues, both dex and GC Overhead

Igor G.

unread,
Aug 24, 2016, 9:18:20 AM8/24/16
to adt...@googlegroups.com
Thanks, I tried that.  Still, the issue was me trying to compile ('com.google.android.gms:play-services-basement:9.4.0') separately.  As you can imagine, there is a lot of classpath overlap between the basement lib and base lib (and other play services libs).  So I don't think there is any solution other than throwing away play-services-basement from the gradle build.

Thank you,
Igor

--
You received this message because you are subscribed to a topic in the Google Groups "adt-dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/adt-dev/r4p-sBLl7DQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to adt-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages