What does Minecraft java.lang.OutOfMemoryError mean?
The short answer
Minecraft has used up all the memory (RAM) your computer set aside for it, and it can’t continue running.
Java, the programming language Minecraft runs on, is given a fixed amount of your computer’s RAM when it launches. When the game needs more than that limit allows, it crashes with this error.
Why does this happen?
A few common reasons:
- Too many mods installed — mods add extra content that all needs to live in memory
- High render distance — loading more chunks of the world uses significantly more RAM
- Large modpacks — popular modpacks like Feed The Beast or RLCraft are memory-hungry
- Too little RAM allocated — Minecraft’s default allocation (usually 2 GB) isn’t enough for heavier setups
- Memory leaks — some mods or older versions don’t release memory properly over time
How to fix it
Allocate more RAM to Minecraft
- Open the Minecraft Launcher
- Go to Installations, then click the three dots on your profile and select Edit
- Click More Options
- Find the JVM Arguments field
- Change
-Xmx2Gto-Xmx4G(or-Xmx6Gfor heavy modpacks) - Save and launch the game
The number after -Xmx is the maximum RAM in gigabytes. Don’t allocate more than half your total system RAM.
Other things to try
- Lower your render distance to 8-12 chunks
- Remove unused mods you’re not actively using
- Update Java to the latest version
- Close other programs like Chrome or Discord that eat up RAM
- Install OptiFine or Sodium to reduce memory usage
When should you worry?
If you have 8 GB of RAM or more and the error keeps happening even after allocating 4-6 GB, something else may be wrong. Look for a specific mod causing a memory leak by removing mods one at a time until the crash stops. Check crash logs in your .minecraft/crash-reports folder for clues about which mod is responsible.