The problem
Fix OutOfMemoryError, "Java heap space" and "Could not reserve enough space for object heap" by allocating the right amount of RAM.
Possible causes
- The modpack needs more memory than is allocated.
- More memory allocated than the PC can spare, so the system refuses to start Java.
- A 32-bit Java runtime, which cannot use more than about 1.5 GB.
- A memory leak in a mod, which makes usage grow until the game crashes.
How to identify the cause
- "Java heap space" or "GC overhead" means the game ran out of allocated memory.
- "Could not reserve enough space" means you asked for more than the system or Java can provide.
- The F3 screen shows memory use in the top right. If it stays near 100%, you need more RAM or fewer mods.
Step-by-step fix
- Use the RAM calculator to pick a value for your pack and PC.
- Set the memory in your launcher. See how to allocate more RAM.
- Leave at least 3–4 GB for the operating system and other programs.
- Make sure you use a 64-bit Java.
- Add memory-saving mods such as FerriteCore and ModernFix if your loader supports them.
If that did not work
- If memory keeps climbing until a crash even with plenty allocated, a mod may be leaking memory. Remove recently added mods to find it.
Affected versions
All Minecraft versions, Java Edition.
Frequently asked questions
Is more RAM always better?
No. Allocating far more than the pack needs can cause longer garbage collection pauses and leaves less memory for your system.
How much RAM does vanilla Minecraft need?
The launcher default of 2 GB is enough for vanilla. Modpacks usually need 4–8 GB.