Minecraft crash: OutOfMemoryError, Java heap space
The game used all the memory the launcher gave it. Give Minecraft more RAM in your launcher, or remove heavy mods.
Updated October 2, 2026. Fabric, NeoForge and Forge.
What you see
The game freezes for a while, then closes. The crash report or log has:
java.lang.OutOfMemoryError: Java heap space
java.lang.OutOfMemoryError: GC overhead limit exceeded
Long freezes and stutter before the crash are the same problem starting: Java spends more and more time freeing memory.
Why it happens
- The launcher gives too little memory. Launchers start with 2 GB or so, made for vanilla. Every mod, texture and loaded chunk needs some.
- The pack grew. A pack that ran fine needs more after you add mods, a resource pack with high resolution textures or a higher render distance.
- One mod leaks memory. If memory runs out after a long time playing, whatever you give it, a mod may keep things it never frees. Removing mods one by one finds it.
Fix it
- Give the game more memory, in the settings of the instance or profile:
- CurseForge app, Modrinth App, Prism Launcher: the memory (RAM) slider.
- Official launcher: Installations, edit the installation, More options, and in
JVM arguments change
-Xmx2Gto-Xmx6G.
- As a guide: around 4 GB for a few dozen mods, 6 to 8 GB for a large modpack. Leave 2 to 4 GB for the rest of the computer.
- Do not give it all your RAM. Above what the pack needs, more memory does not help and can make pauses longer.
- Still crashing with enough memory: lower render distance, remove high resolution resource packs, and look for a mod that leaks.
Let the game tell you
The Modkeel Companion tells a memory crash apart from a mod crash on the next start, so you do not remove mods that were not at fault, and it shows the worst lag spikes of a session with the mods whose code ran during them. Free and open source, for Fabric, NeoForge and Forge.