The Java Heap Space error means Minecraft ran out of the RAM you allocated to it. The fix is increasing the JVM memory allocation in your launcher settings. Vanilla Minecraft needs at least 2–4 GB; heavily modded packs often need 6–12 GB.
Increase RAM in the launcher
In the Minecraft Launcher: go to Installations, find your installation, click the three dots > Edit > More Options. In the JVM Arguments field, find -Xmx (maximum heap). Change -Xmx2G to -Xmx4G or higher. Do not exceed 75% of your system RAM.
Identify memory hogs
Mods vary dramatically in memory usage. Heavy rendering mods (shaders, physics, world generation) and mods that keep many chunks loaded consume the most RAM. Check your mod list for known memory-intensive mods.
How to fix step by step
- 1In Minecraft Launcher: Installations > Edit installation > More Options > JVM Arguments
- 2Change -Xmx to a higher value (e.g., -Xmx4G for 4 GB, -Xmx6G for 6 GB)
- 3Do not exceed 75% of your total physical RAM in this value
- 4Restart Minecraft after changing the allocation
How JAVA-HEAP-SPACE differs from related codes
- Error OUT-OF-MEMORY: Minecraft's Java process ran out of allocated memory (heap space). The game crashed because it could not allocate more RAM. (user-side)
- Error EXIT-CODE-1: The Java Virtual Machine running Minecraft crashed and exited with code 1, indicating a fatal error. This is typically a Java or mod compatibility issue. (user-side)
- Error CRASH-REPORT: Minecraft's Java Virtual Machine (JVM) encountered a fatal error that could not be caught by the game. A crash-report or hs_err_pid log file was created containing the stack trace and error details. (usually client-side)