Out of memory

Minecraft Crash: java.lang.OutOfMemoryError (Heap or Native Memory Exhausted)

What the log looks like

java\.lang\.OutOfMemoryError

How to fix it

  1. Increase your allocated Java memory (`-Xmx`) in your launcher's instance settings or your server's `run.bat`/`run.sh` script: use 4G–6G for small-to-medium modpacks and 6G–8G for large modpacks or busy modded servers.
  2. Do not allocate all of your PC's RAM to Minecraft—always leave at least 4 GB of physical system RAM free for Windows, GPU drivers, and native off-heap buffers.
  3. If your crash trace includes `org.lwjgl.system.MemoryUtil.nmemReallocChecked` (especially with Sodium or Iris shaders), lower your Render Distance and Shadow Distance, and lower `-Xmx` slightly if your PC has 16 GB of RAM or less.
  4. On Windows, verify that Virtual Memory (pagefile) is set to 'System managed size' in Advanced System Settings; disabling or restricting the pagefile causes native `MemoryUtil` crashes even when free RAM appears available.
  5. If the game still runs out of memory with 8 GB allocated, test without shaders, high-resolution resource packs, or recently installed rendering/entity-model mods to isolate a memory leak.
LoadersForge, Neoforge, Fabric, Quilt, Vanilla, Server
SeverityStops the game
CategoryOut of memory

Check your own log

Related errors