Skip to content

Commit

Permalink
Increase memory used for forked compiler
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sciwhiz12 committed Dec 10, 2024
1 parent ac0abaf commit 1550e38
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions projects/neoforge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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:<em>API Note:</em>',
Expand Down

0 comments on commit 1550e38

Please sign in to comment.