Skip to content
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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Conversation

osipxd
Copy link
Member

@osipxd osipxd commented Nov 15, 2024

Subsystem
Build Infrastructure

Motivation
It is hard to build the project on machines with 16 GB RAM because of high memory consumption.

Solution

This is a WIP PR for those who are interested in trying the new daemon configurations.

@osipxd osipxd self-assigned this Nov 15, 2024
@osipxd osipxd changed the title Osipxd/decrease memory usage Decrease memory usage Nov 15, 2024
@osipxd osipxd changed the title Decrease memory usage Decrease Gradle memory usage Nov 15, 2024
@@ -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
Copy link
Member Author

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
Copy link
Member Author

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.

@osipxd osipxd changed the title Decrease Gradle memory usage Decrease Gradle memory consumption Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant