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
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.
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.
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.
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é
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