I'm trying to gradling ant based (Netbeans RCP) project and finding the strange gradle behavior. I made some observation with profiler and get the next results.
Gradle 1.9
Build time: 2013-11-19 08:20:02 UTC
Build number: none
Revision: 7970ec3503b4f5767ee1c1c69f8b4186c4763e3d
Groovy: 1.8.6
Ant: Apache Ant(TM) version 1.9.2 compiled on July 8 2013
Ivy: 2.2.0
JVM: 1.7.0_45 (Oracle Corporation 24.45-b08)
OS: Linux 2.6.32-431.el6.x86_64 amd64
$ echo $GRADLE_OPTS
-XX:+UnlockCommercialFeatures -XX:+FlightRecorder -Xms256m -Xmx2048m
$ echo $ANT_OPTS
-XX:+UnlockCommercialFeatures -XX:+FlightRecorder -Xms256m -Xmx2048m
build.gradle - contains import for ant tasks (clean, build, unit tests)
settings.gradle
Gradle fork separate jvm for this and run JUnitTestRunner with different Xmx value, ignoring $GRADLE_OPTS and $ANT_OPTS values
No idea how gradle define Xmx size for each JUnitTestRunner ant task. It works fine, as a GC during each tasks. All unit tests for all modules passed without errors.
Gradle knows previous build results and immediately starting junit tests for untested module. You may see the output here! Gradle fork separate jvm (ignoring $GRADLE_OPTS value) for this and run GradleWorkerMain. And this jvm has 1.42GB Xmx and 500 MB immediately occupied! Then used memory size reaches 1.5GB. Then GC for unknown reason can't free memory and throw
-java.lang.OutOfMemoryError: GC overhead limit exceeded
-console log
why ant task max Xmx size in 540 MB enough for testing while for GradleWorkerMain 1.5GB is not enough?
I'm new to gradle so may be my build.gradle contains errors that result in such GradleWorkerMain strange behavior. Is it true? What possible solution is?
how to provide for GradleWorkerMain jvm more Xmx?
To control how much memory is available to Gradle test JVMs, configure the corresponding Test
tasks. For example:
test {
maxHeapSize = "1024m"
jvmArgs "-XX:MaxPermSize=256m"
}
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