Search code examples
gradleintellij-ideakotlin

How to set max memory size of kotlin compiler


I'm trying to compile large kotlin project that use Gradle. So I can't just edit settings of Kotlin compiler in intellij IDEA because they will be overridden.
I've tried to set freeCompilerArgs

allprojects {
    apply plugin: 'java'
    apply plugin: 'kotlin'
    apply plugin: 'idea'

    compileKotlin {
        kotlinOptions {
            freeCompilerArgs = ['-Xmx10G', '-Xjvm-default=enable']
        }
    }
}

But it didn't help. What I'm doing wrong?


Solution

  • According to settings in the official gradle repository, the following option should be used in gradle.properties file:

    org.gradle.jvmargs=-Dkotlin.daemon.jvm.options=-Xmx10G