I am trying to go to the ant project (NetBeans RCP) and find the weird gradle behavior. I made some observations using the profiler and got the following results.
Environment configuration
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
Running imported ant junit test tasks with gradle
Gradle fork a separate jvm for this and run JUnitTestRunner with a different Xmx value, ignoring $ GRADLE_OPTS and $ ANT_OPTS: - 108.80 MB
I don't know how gradle to determine the Xmx size for each JUnitTestRunner ant task. It works just like a GC during every task. All unit tests for all modules passed without errors.
Running gradle build tasks for the same modules
Gradle knows the previous build results and immediately runs junit tests for an unverified module. You can see the exit here ! Gradle fork a separate jvm (ignoring the value of $ GRADLE_OPTS) for this and run GradleWorkerMain. And this jvm has 1.42GB Xmx and 500 MB (see snapshot ) immediately took! Then the size of the used memory reaches 1.5 GB. Then, for some unknown reason, GC cannot free memory and throw it away.
- java.lang.OutOfMemoryError: GC upper limit exceeded
- console log
- snapshot
More details:
- Gradle jvm master data
- jvm details for GradleWorkerMain
Questions
Why is the ant task max Xmx the size of 540 MB is enough for testing, and for GradleWorkerMain 1.5 GB is not enough?
I'm new to gradle, so maybe my build.gradle contains bugs that result in such a weird GradleWorkerMain behavior. It's true? What is the possible solution?
How to provide GradleWorkerMain jvm more Xmx?
source share