Increase heap size for gradle importing tests due to memory

leak in the gradle daemon
#KT-32731 Fixed
This commit is contained in:
Andrey Uskov
2019-07-22 13:02:01 +03:00
parent db743aa6e8
commit 8294e5afc2
@@ -93,6 +93,17 @@ abstract class GradleImportingTestCase : ExternalSystemImportingTestCase() {
open fun isApplicableTest(): Boolean = true
open fun jvmHeapArgsByGradleVersion(version: String) : String = when {
version.startsWith("4.") ->
// work-around due to memory leak in class loaders in gradle. The amount of used memory in the gradle daemon
// is drammatically increased on every reimport of project due to sequential compilation of build scripts.
// see more details in https://github.com/gradle/gradle/commit/b483d29f315758913791fe58d572fa6bafa0395c
"-Xmx256m -XX:MaxPermSize=64m"
else ->
// 128M should be enough for gradle 5.0+ (leak is fixed), and <4.0 (amount of tests is less)
"-Xmx128m -XX:MaxPermSize=64m"
}
override fun setUp() {
myJdkHome = IdeaTestUtil.requireRealJdkHome()
super.setUp()
@@ -114,7 +125,7 @@ abstract class GradleImportingTestCase : ExternalSystemImportingTestCase() {
}
GradleSettings.getInstance(myProject).gradleVmOptions =
"-Xmx128m -XX:MaxPermSize=64m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${System.getProperty("user.dir")}"
"${jvmHeapArgsByGradleVersion(gradleVersion)} -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${System.getProperty("user.dir")}"
System.setProperty(ExternalSystemExecutionSettings.REMOTE_PROCESS_IDLE_TTL_IN_MS_KEY, GRADLE_DAEMON_TTL_MS.toString())
configureWrapper()