OutOfMemoryError in Minecraft: how to get rid of it
The game crashes with “java.lang.OutOfMemoryError” or freezes every minute? How much memory you need, where to change it and when the amount isn't the problem.
Updated:

java.lang.OutOfMemoryError: Java heap space — the game asked for more memory than it was allowed. The fix seems simple: add memory. But sometimes too much memory makes things worse, and sometimes a mod is leaking. Let's sort it out.
How much memory you need
- Vanilla — 2–4 GB.
- An instance with up to 50 mods — 4–6 GB.
- A big modpack with 150–300 mods — 6–10 GB.
- Shaders and a long render distance — plus 1–2 GB.
The main rule: leave at least 3–4 GB for the system. On a computer with 8 GB, don't give the game more than 4–5 GB. More — how much memory to allocate to Minecraft.
Where to change memory
TCLauncher has default memory in the launcher settings and separate memory for each instance. You can give a 200-mod modpack 8 GB without touching vanilla instances. The “Resources” tab shows how much memory the computer has and how much is free right now.
How to tell that memory really is short
After each session the launcher saves how much memory the game used. If the “Statistics” tab shows the game hitting the limit, add 1–2 GB. In the game itself press F3: the Mem line at the top right shows used and available memory. Constantly above 90% means too little.
When more is worse
If you give the game almost all memory, Windows starts swapping to disk and the whole system stutters. And a very large Java heap collects garbage less often but for longer — instead of tiny micro-stutters you get noticeable half-second freezes. So 16 GB for a small instance won't help, it will hurt.
When the amount isn't the problem
- A memory leak in a mod: usage grows and grows until the game crashes, no matter how much you gave. Find the mod after which it started, and update or disable it.
- Huge resource packs of 512x and above eat gigabytes of video memory and RAM.
- 32-bit Java can't take more than ~1.5 GB. The launcher installs 64-bit; check if you set Java manually.
- “unable to create native thread” — this is a system limit, not the heap. Close unnecessary programs.
Mods that reduce the appetite
FerriteCore noticeably reduces memory use in big instances, and ModernFix speeds up loading and trims some of the excess. Both are in the catalogue of the “Mods” tab. More tips — in the article best FPS mods.
Download TCLauncher — memory is set separately for each instance.
FAQ
How much memory should I set to avoid OutOfMemoryError?
Vanilla 2–4 GB, a modded instance 4–8 GB, big modpacks up to 10 GB. Leave 3–4 GB for the system.
Will setting 16 GB help?
For most instances no: extra memory means longer garbage collection pauses and the system runs short. Add 1–2 GB at a time and watch the statistics.
Memory keeps growing until the game crashes. What is it?
Probably a memory leak in one of the mods. Update your mods or disable the ones installed last.