MinecraftUpdated 2 min read

How to Fix Out of Memory Errors on a Minecraft Server

Your server crashed with OutOfMemoryError. Here's why, and what to change.

java.lang.OutOfMemoryError: Java heap space means the server needed more memory than it has.

See how close you are

Watch the Memory graph on Console while players are on. If it climbs to your plan's limit before the crash, the server is running out.

Common causes

Cause Fix
A large modpack Modpacks often need 6–10 GB. Check the pack's recommendation
High view-distance or simulation-distance Lower them in server.properties (8 and 6 are good starts)
Pre-generating or exploring a lot of new terrain Pre-generate with Chunky when few players are on
Too many loaded worlds Unload worlds nobody uses (mv unload <name> with Multiverse)
Huge farms and item piles Fewer entities means less memory
A memory leak in a plugin or mod Restart regularly with Schedules, and update the plugin or mod

Measure it

Install spark from Package Manager and run spark health to see memory use, or spark heapsummary to see what's using it.

Need more memory?

Change your plan from Service & billing in the sidebar. Plan changes keep your files and world. See How to Upgrade or Downgrade a Server.

Note

The server's memory limit is set by your plan; you don't need to set -Xmx yourself.