-
Notifications
You must be signed in to change notification settings - Fork 31
Increase Gradle JVM memory to prevent out of memory error #1427
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
base: main
Are you sure you want to change the base?
Increase Gradle JVM memory to prevent out of memory error #1427
Conversation
…branchtoWorkflow Add intellij-2025.3-support branch to CI workflow
65d8d4d to
4cccde3
Compare
| lclsVersion=2.3.2 | ||
|
|
||
| # Increase Gradle memory to prevent OutOfMemoryError | ||
| org.gradle.jvmargs=-Xmx6g |
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.
@anusreelakshmi934 since this is just a properties file, do you know how this property actually gets pulled in to the environment where the build/tests are running? Typically, the properties listed in this file are referenced in build.gradle, but I don't see this one.
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 also noticed this line in the build.gradle...
liberty-tools-intellij/build.gradle
Lines 23 to 27 in b1d9e02
| // Increase Java heap size to avoid OutOfMemoryError during compilation or tests. | |
| // This setting addresses issues where the JVM runs out of memory, particularly during | |
| // large builds or tests. The '2g' value specifies a maximum heap size of 2GB | |
| // (-Xmx2g), which should be enough to prevent memory exhaustion in most cases. | |
| options.forkOptions.memoryMaximumSize = "2g" |
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 noticed the options.forkOptions.memoryMaximumSize = "2g" setting, but from what I understand that only affects the forked Javac process. The OutOfMemoryError occurs in Gradle’s internals, meaning the daemon JVM is running out of memory. This fix is to increase the daemon heap via org.gradle.jvmargs to give it enough memory.
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.
@anusreelakshmi934 since this is just a properties file, do you know how this property actually gets pulled in to the environment where the build/tests are running? Typically, the properties listed in this file are referenced in
build.gradle, but I don't see this one.
Gradle automatically reads gradle.properties and applies -Xmx6g to the Gradle daemon JVM. There's no need to reference it in build.gradle. The org.gradle.jvmargs property is special, Gradle picks it up from gradle.properties and uses it internally to configure the JVM for the Gradle daemon. As a result, any builds or tests executed through Gradle will automatically inherit this JVM argument. -
https://docs.gradle.org/current/userguide/config_gradle.html?utm_source=chatgpt.com#sec:configuring_jvm_memory
Here I have just printed the info about the memory that is being used - https://github.com/anusreelakshmi934/liberty-tools-intellij/actions/runs/18771459676/job/53556716966#step:8:21
Fixes #1383