# \[SOLVED\] Disable Kotlin compiler process keepalive?

**URL:** <https://discuss.kotlinlang.org/t/solved-disable-kotlin-compiler-process-keepalive/2622>\
**Category:** Support\
**Created:** [May 17, 2017, 1:51am UTC](https://discuss.kotlinlang.org/t/solved-disable-kotlin-compiler-process-keepalive/2622 "2017-05-17T01:51:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jtietema](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/jtietema/32/2443_2.png) [@jtietema](https://discuss.kotlinlang.org/u/jtietema)\
**Post date:** [May 17, 2017, 1:51am UTC](https://discuss.kotlinlang.org/t/solved-disable-kotlin-compiler-process-keepalive/2622/1 "2017-05-17T01:51:15Z")

</div>

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 ☹

Any pointers would be helpful.

---

<div class="post-metadata">

**Author:** ![ilya.chernikov](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/ilya.chernikov/32/1455_2.png) [@ilya.chernikov](https://discuss.kotlinlang.org/u/ilya.chernikov)\
**Post date:** [May 17, 2017, 3:40pm UTC](https://discuss.kotlinlang.org/t/solved-disable-kotlin-compiler-process-keepalive/2622/2 "2017-05-17T15:40:18Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jtietema](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/jtietema/32/2443_2.png) [@jtietema](https://discuss.kotlinlang.org/u/jtietema)\
**Post date:** [May 18, 2017, 1:40am UTC](https://discuss.kotlinlang.org/t/solved-disable-kotlin-compiler-process-keepalive/2622/3 "2017-05-18T01:40:50Z")

</div>

Thanks @ilya.chernikov that works like a charm 😄

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