GradleWorkerMain OutOfMemoryError

I'm trying to score the NetBeans RCP project and find strange gradle behavior

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

> build. Gradle – contains the import of ant tasks (clean-up, build, unit test) > settings gradle

Run the imported ant JUnit test task using gradle

Gradle fork separates the JVM for this purpose and runs junittestrunner with different Xmx values, ignoring $gradle_ Opts and $ant_ Opts value: – 108.80 MB

> 540 MB > 183 MB

I don't know how gradle defines the Xmx size for each JUnit testrunner ant task It works normally as a GC during each task All unit tests of all modules passed without error

Run the gradle build task for the same module

Gradle knows the results of previous builds and immediately starts JUnit testing untested modules You may see the output here! Gradle fork detaches the JVM for this purpose (ignoring the $gradle_opts value) and runs gradleworkermain The JVM has 1.42gb Xmx and 500 MB (see snapshot) and is occupied immediately! Then the memory size used reaches 1.5GB Then GC cannot free memory for unknown reasons and throws

–java. lang.OutOfMemoryError: GC overhead limit exceeded

–console log

–snapshot

More details:

–gradle main jvm details

–GradleWorkerMain jvm details

problem

>Why is the max Xmx size of ant task 540mb enough for testing and gradleworkermain 1.5GB not enough? > I'm a novice, so it may be my build Gradle contains errors that result in strange behavior in such gradleworkermain But is it really the case? What are the possible solutions? > How can I provide more Xmx for the gradleworkermain JVM?

Solution

To control the amount of memory available to the gradle test JVM, configure the appropriate test tasks For example:

test {
    maxHeapSize = "1024m"
    jvmArgs "-XX:MaxPermSize=256m"
}
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>