MiniHUD

MiniHUD

3M Downloads

[fabric/1.19.x] java.lang.OutOfMemoryError: Java heap space

ChillerDragon opened this issue ยท 6 comments

commented
$ git checkout pre-rewrite/fabric/1.19.x 
branch 'pre-rewrite/fabric/1.19.x' set up to track 'origin/pre-rewrite/fabric/1.19.x'.
Switched to a new branch 'pre-rewrite/fabric/1.19.x'
$ ./gradlew build
Starting a Gradle Daemon (subsequent builds will be faster)

> Configure project :
Fabric Loom: 0.12.56
:remapping 3 mods (TinyRemapper, intermediary -> named)

Exception in thread "Daemon health stats" java.lang.OutOfMemoryError: Java heap space

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'minihud'.
> Failed to notify project evaluation listener.
   > Java heap space

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 24s

I fixed it by creating a gradle.properties file and add the following line to it

org.gradle.jvmargs=-Xmx4096m

Not sure if this is a proper fix that should be added to the project or if there is a better way. I wonder why it is failing on my system in the first place? Do I have different gradle memory size defaults? I am not a java dev no idea how gradle works.

My system:

$ java --version
openjdk 17.0.4.1 2022-08-12
OpenJDK Runtime Environment (build 17.0.4.1+1)
OpenJDK 64-Bit Server VM (build 17.0.4.1+1, mixed mode)
$ uname -a
Linux arch 5.19.3-arch1-1 #1 SMP PREEMPT_DYNAMIC Sun, 21 Aug 2022 18:55:22 +0000 x86_64 GNU/Linux
$ gradle --version

Welcome to Gradle 7.5.1!

Here are the highlights of this release:
 - Support for Java 18
 - Support for building with Groovy 4
 - Much more responsive continuous builds
 - Improved diagnostics for dependency resolution

For more details see https://docs.gradle.org/7.5.1/release-notes.html


------------------------------------------------------------
Gradle 7.5.1
------------------------------------------------------------

Build time:   2022-08-06 13:53:45 UTC
Revision:     <unknown>

Kotlin:       1.6.21
Groovy:       3.0.10
Ant:          Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM:          17.0.4.1 (Oracle Corporation 17.0.4.1+1)
OS:           Linux 5.19.3-arch1-1 amd64
commented

You can find the builds/jar on curseforge also.

commented

You can find the builds/jar on curseforge also.

I can build fine using org.gradle.jvmargs=-Xmx4096m I am just reporting that building is not smooth.

commented

I get the same issue in https://github.com/maruohon/malilib might be related

commented

It's because masa has a global Gradle configuration that looks like this:

$ cat ~/.gradle/gradle.properties
org.gradle.daemon=false
org.gradle.jvmargs=-Xmx4096M

But yeah, it's not smooth.

commented

It's because masa has a global Gradle configuration that looks like this:

$ cat ~/.gradle/gradle.properties
org.gradle.daemon=false
org.gradle.jvmargs=-Xmx4096M

But yeah, it's not smooth.

So what about adding that to a local config in the repo for others?

commented

Yeah I should add the properties file in the mod repos. I should maybe also move the mod versions and stuff to that file instead of using the "Config Slurper" to read them from the separate build.properties file.

I just need to test if it works properly in the 1.12.2 branches using the old 2.14.1 Gradle version. Or if I need to do it in 1.13.2 or so when I start using Gradle 4.9 until 1.16.5, and then Gradle 7+ in 1.17+.