Guide · Troubleshooting

Fixing out-of-memory crashes

Memory problems show up in two different ways, and the fixes are opposite. Working out which one you have is the first step.

Two kinds of out-of-memory

java.lang.OutOfMemoryError: Java heap space means Java used all the heap you gave it with -Xmx. The fix is a larger heap or less memory use.

If the server disappears with no Java error, or the panel reports it was killed for exceeding memory, Java asked for more than the machine or container allows. The heap was set too close to the limit. The fix is a smaller -Xmx, leaving room for Java's other memory.

Set the heap correctly

Leave around 1 to 1.5 GB between -Xmx and the total memory available, more on large modpacks. On a hosted server, the panel normally sets this from your plan; avoid overriding it with a bigger number.

Find what uses memory

Run spark heapsummary to see which objects fill the heap. Steady growth over hours that a restart resets points at a leak in a plugin or mod. Big jumps when players explore point at chunk loading. A modpack that needs more than you have will run near its limit from the moment it starts.

  • Lower view and simulation distance
  • Pre-generate terrain and set a world border
  • Remove or update the plugin or mod that leaks
  • Schedule a daily restart while you investigate

When to upgrade

If the server sits near its memory limit under normal load with sensible settings, it simply needs more. Modpacks are the usual case. On StormNodes, moving to a larger plan keeps your files and world as they are.

StormNodes Minecraft hosting

Run it on a StormNodes server

Skip the port forwarding and the PC that has to stay on. A StormNodes Minecraft server is online in minutes, and everything in this guide can be done from the panel.

  • Hosted in Portugal, close to players across Western Europe
  • NVMe storage, monthly billing and no setup fee
  • Paper, Purpur, Fabric and vanilla, switchable from the panel
  • Live console, file manager, SFTP, backups and schedules
  • Support in English and Portuguese

FAQ

Frequently asked questions

How much RAM should I give Java?
Your plan or machine's memory minus about 1 to 1.5 GB. Setting -Xmx equal to the total limit gets the process killed.
Why does memory usage keep growing?
Java keeps the heap it has used, so high usage is normal. Real problems show as frequent long garbage collection pauses or crashes, not a high number on its own.
Will adding RAM fix lag?
Only lag caused by memory pressure. Most lag is CPU time on the main thread, which more RAM does not help.