From 1550e38de16abfd250c148e84988db960d6e414f Mon Sep 17 00:00:00 2001 From: sciwhiz12 Date: Tue, 10 Dec 2024 08:27:49 +0800 Subject: [PATCH] Increase memory used for forked compiler When running the Gradle Daemon with a non-J21 JVM, it will fork the Java compiler into a separate process rather than running it in-process with the Daemon. However, that means the compiler process uses the default amount of memory, which is not able to compile all of NeoForge & Minecraft (as it fails with an OutOfMemoryError). Setting the memory when the compiler is forked ensures that whether the compiler runs in-process with the Daemon or as a forked process, it will always have enough memory to compile all the sources properly. --- projects/neoforge/build.gradle | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/projects/neoforge/build.gradle b/projects/neoforge/build.gradle index 6fb662a162..62b3a5688c 100644 --- a/projects/neoforge/build.gradle +++ b/projects/neoforge/build.gradle @@ -222,6 +222,11 @@ generateAccessTransformers { ) } +tasks.withType(JavaCompile.class).configureEach { + // Increase memory used during compilation, to avoid OutOfMemoryErrors + options.forkOptions.memoryMaximumSize = '2g' +} + tasks.withType(Javadoc.class).configureEach { options.tags = [ 'apiNote:a:API Note:',