Exceeded GC limit exceeded attempt to create LibGDX project

I am trying to run a LibGDX project with an iOS config, but I keep giving the following error:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':ios:launchIPhoneSimulator'.
> java.lang.OutOfMemoryError: GC overhead limit exceeded

      

I tried modifying the gradlew file with the following parameters, but I still get the same error:

DEFAULT_JVM_OPTS="-Xmx2048m -XX:+UseConcMarkSweepGC"

      

Any ideas what else I can do to work around this issue? Thank!

+3


source to share


4 answers


Tried a few different things (gradlew clean, removing dependencies and loading them again, increasing the heap size all the way to 2g, etc.) but in the end what fixed it was rebooting the machine.



Yes, a reboot fixed that. Weird.

+6


source


I had the same problem ... but I found a solution! Open the gradle.properties file and it should look something like this:

org.gradle.daemon=true
org.gradle.jvmargs=-Xms128m -Xmx512m
org.gradle.configureondemand=true

      

You must edit the second line! Change "-Xms128m" to "-Xms1024m", "-Xmx512m" to "-Xmx4096m" and "gradle.properties" in the final should look like this:



org.gradle.daemon=true
org.gradle.jvmargs=-Xms1024m -Xmx4096m
org.gradle.configureondemand=true

      

What is it!

+1


source


You can turn off this error by adding the following flag: -XX: -UseGCOverheadLimit, But this is a bad approach.

This exception is thrown when the FULL GC ran frequently at the last minute and did not free memory (or released too low memory).

You can try to add extra memory, for example try adding -Xmx3048m (or more). If the exception still occurs, then there is definitely a memory leak problem.

0


source


If you don't change your code but you suddenly have this problem, my suggestion is to restart android studio, clean project, restart your emulator. If not, change your build.gradle code.

0


source







All Articles