Out of Memory / java.lang.OutOfMemoryError
Mojang Minecraft
Severity: ModerateWhat Does This Error Mean?
Out of Memory means Minecraft does not have enough RAM allocated to run. The default allocation is often too low for modded Minecraft or high render distances. Increase the RAM allocation in the Minecraft launcher.
Affected Models
- Minecraft Java Edition
- PC
- macOS
- Linux
Common Causes
- Default RAM allocation too low (usually 2GB)
- Too many mods installed consuming memory
- Render distance set too high
- Resource pack with very high-resolution textures
- Memory leak in a mod
How to Fix It
-
Increase RAM allocation in the Minecraft Launcher.
Launcher > Installations > Edit > More Options > JVM Arguments. Change -Xmx2G to -Xmx4G (or -Xmx6G for heavy modpacks). Do not allocate more than half your total system RAM.
-
Reduce render distance to 8-12 chunks.
High render distances (20+) use enormous amounts of RAM. 8-12 chunks is a good balance of performance and visibility.
-
Remove unnecessary mods.
Each mod uses additional RAM. Large modpacks can need 6-8GB. Remove mods you are not actively using.
-
Close other applications before launching Minecraft.
Web browsers (especially Chrome) use significant RAM. Close them to free memory for Minecraft.
Frequently Asked Questions
How much RAM does Minecraft need?
Vanilla: 2-4GB. Light mods: 4-6GB. Heavy modpacks (All the Mods, RLCraft): 6-8GB. Shader packs need more VRAM (GPU memory) rather than system RAM.
Can I allocate too much RAM to Minecraft?
Yes. Allocating too much causes Java's garbage collector to run inefficiently, causing lag spikes. Never allocate more than 8GB or more than half your total RAM.