-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Decrease Gradle memory consumption #4483
base: main
Are you sure you want to change the base?
Conversation
@@ -11,7 +11,8 @@ version=3.0.2-SNAPSHOT | |||
# gradle | |||
org.gradle.daemon=true | |||
org.gradle.caching=true | |||
org.gradle.jvmargs=-Xmx10g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:+UseParallelGC | |||
# Argument -Dkotlin.daemon.jvm.option is used for the Kotlin Daemon started by Gradle to compile .gradle.kts scripts | |||
org.gradle.jvmargs=-Xms4g -Xmx6g -XX:MaxMetaspaceSize=1g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:+UseParallelGC -Dkotlin.daemon.jvm.options=-Xmx512m,Xms256m,-XX:MaxMetaspaceSize=256m,XX:+HeapDumpOnOutOfMemoryError |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a chance to get an OOM when running an expensive task (like clean build
) on non-fresh Gradle daemon.
So probably we should specify 8 GB by default. Or, as an alternative, we could describe this problem in a comment 😅
enableTestCaching = false | ||
} | ||
//doctor { | ||
// enableTestCaching = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to disable Gradle Doctor by default but provide a way to enable it.
To do so, I should port behavior of enableTestCaching = false
first to benefit from it even with disabled Gradle Doctor.
Subsystem
Build Infrastructure
Motivation
It is hard to build the project on machines with 16 GB RAM because of high memory consumption.
Solution
Xmx
for Kotlin Daemon (including the one used by Gradle to compile Kotlin DSL scripts)Xmx
for Gradle Daemon-XX:MaxMetaspaceSize
to prevent Gradle from being silently killed by OS due to unlimited metaspace consumption (see Settingorg.gradle.jvmargs
property can lead to "Daemon disappeared" failures gradle/gradle#19750).This is a WIP PR for those who are interested in trying the new daemon configurations.