Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is gradle memory increasing with amount of unit tests? (gradle 1.x)

Tags:

gradle

Our unit test count has been increasing and gradle has now started running out of memory...

* What went wrong:
Execution failed for task ':test'.
> Java heap space

So we added gradle.properties with the jvm args -Xmx512m. I am wondering why gradle uses more and more memory as we add unit tests. Memory use should be constant, shouldn't it?

This is on the github project playorm found here https://github.com/deanhiller/playorm

Dean

like image 426
Dean Hiller Avatar asked Jul 16 '13 14:07

Dean Hiller


People also ask

How increase Gradle build memory?

Example# You can set or increase memory usage limits (or other JVM arguments) used for Gradle builds and the Gradle Daemon by editing $GRADLE_USER_HOME/. gradle/gradle.

How much RAM do you want to allocate to Gradle?

512MB is more than enough for most builds. Larger builds with hundreds of subprojects, lots of configuration, and source code may require, or perform better, with more memory.

Does Gradle run tests in parallel by default?

Parallel execution Yet Gradle will only run one task at a time by default, regardless of the project structure (this will be improved soon). By using the --parallel switch, you can force Gradle to execute tasks in parallel as long as those tasks are in different projects.


1 Answers

All Tests executed using the Gradle Test task are executed in a seperate jvm and not in the jvm, the gradle build is executed with. So changing values in gradle.properties does not solve your problem. To increase the memory of the Test - JVM you have to configure the Test task.

test{
     maxHeapSize = "512m"
}

hope that helped,

Answer to Dean's issue is in comments.

René

like image 115
Rene Groeschke Avatar answered Sep 20 '22 20:09

Rene Groeschke