I have a problem running 'gradle test' against my Spring Boot application as I see signs of GC called too many times and my tests fail likely due to delays caused by agressive GC work.
How I can tell gradle to use more heap memory allowed for JVM during test phase, or in general?
You can use the maxHeapSize
configuration of the Test
task.
Example in Gradle/Groovy:
test { minHeapSize = "128m" // initial heap size maxHeapSize = "512m" // maximum heap size jvmArgs '-XX:MaxPermSize=256m' // mem argument for the test JVM }
Or the same in Kotlin:
withType<Test> { minHeapSize = "512m" maxHeapSize = "1024m" jvmArgs = listOf("-XX:MaxPermSize=512m") }
Check out the official docs for additional info.
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