Reputation: 20210
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
Upvotes: 11
Views: 8954
Reputation: 923
I am having the exact same issue (huge memory usage when running tests with gradle). I am actually testing a custom plugin that is downloading pom and jar/war, and it seems the debug output logs pretty much the whole files downloaded content. And during the execution, I have the feeling all this logging is stored in memory. I am using Gradle 1.7 with Java 1.6.
Upvotes: 0
Reputation: 28663
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é
Upvotes: 22