[SOLVED] Disable Kotlin compiler process keepalive?


Is there a way to disable the keepalive of the Kotlin compiler process? I am running via Android Studio in a gradle based Android project.

The UI toggle in settings, seems to be borken / not implemented. Is that a flag I can pass to gradle that will signal the kotlin compiler to exit?

Alternatively is there a way to limit the memory usage? It seems to inherit the JVM memory settings from the Gradle Daemon, which for our Android project are set to 5GB, now the Kotlin Compiler eats up to 5GB as well :frowning:

Any pointers would be helpful.


The convenient configuration is lacking here, but you can do both via system properties.
To disable kotlin daemon you need to pass -Dkotlin.compiler.execution.strategy="in-process" for the gradle daemon (e.g. via GRADLE_OPTS)
To set memory options for the daemon - pass -Dkotlin.daemon.jvm.options=-Xmx<xxx> to it.


Thanks @ilya.chernikov that works like a charm :smile:

Modified my gradle.properties as follows:
org.gradle.jvmargs=-Xmx6g -XX:MaxPermSize=512m -Dkotlin.compiler.execution.strategy=“in-process”