java.lang.OutOfMemoryError: Java heap space, what to do
Your Minecraft server crashed with a Java heap space error. Restart once first; if it repeats, you are under-allocated for the pack you are running.
The short version
java.lang.OutOfMemoryError: Java heap space means the JVM ran out of room while running. Restart once first, because a single OOM after hours of uptime can be transient. If it repeats on boot, you are under-allocated for the pack and the fix is a larger plan, not a JVM flag.
A java.lang.OutOfMemoryError: Java heap space means the JVM asked the operating system for memory, did not get it, and gave up. On a Hostd Minecraft server it always falls into one of two buckets: a one-off after long uptime (transient), or every time you press start (you are under-allocated). The fix is different for each.
#Step 1: restart once
Open Dashboard → your server → Console panel, hit Stop, wait five seconds, then Start. A heap exhaustion after several days of uptime is often a slow leak in a single mod or plugin that clears on a fresh JVM. If the server comes back up and stays up, you are done; mark it on the calendar and watch for the next one.
#Step 2: if it crashes on boot
When the error fires within the first minute of startup, the JVM never had a chance to leak anything. The pack itself needs more RAM than your plan can give it. Two paths:
- Trim the pack. Open Files → /data/mods and remove mods you do not actually use. Modpack authors often ship optional addons (alternative storage, secondary worldgen, decorative blocks) that are easy to drop. After deleting, restart.
- Move to a bigger tier. On the Java ladder, the 3 GB plan is for unmodded servers only, the 6 GB plan handles light packs, the 10 GB plan is the floor for ATM, FTB Skies, Better MC, and RLCraft, and the 14 GB plan is for those packs with 10+ active players. Picking a tier has the full table.
#Step 3: rule out a runaway mod
A handful of mods are known heap eaters at scale: outdated Pixelmon builds, Ender IO conduit networks past a certain size, Applied Energistics 2 networks with thousands of items being indexed, and any mod that scans the whole world every tick. Install Spark and run:
/spark heapsummary
It prints the top memory holders by class. If a single mod's class is sitting on a gigabyte of objects, that is your leak. Update the mod or remove it.
#Why we do not let you change -Xmx directly
Plans are kernel-locked. Your Modded plan has 6 GB available because that is what we have reserved for you in the cgroup; the JVM cannot exceed that even if a flag asks for more. The Files page blocks edits to user_jvm_args.txt, jvm_args.txt, unix_args.txt and the related launcher files for the same reason: setting -Xmx above the plan size only produces the next error (Could not reserve enough space for object heap).
#Where to go next
- Minecraft server won't start if you are seeing other startup errors as well.
- Fixing Minecraft server lag once you are back on a tier that fits the pack.
- Could not reserve enough space for object heap if the OOM message is slightly different.
#Frequently asked questions
What does java.lang.OutOfMemoryError: Java heap space mean?
The JVM needed more heap than it had while the server was running, and gave up. It is different from a heap reservation failure, which happens at startup before the server runs at all. This one means the server was working and ran out.
How do I fix a Java heap space error on a Minecraft server?
Restart once to rule out a transient spike. If it comes back, either reduce what the server is doing, by trimming unused mods, or upgrade to a tier with more RAM. On Hostd, RAM is set by the plan, so -Xmx is not the lever.
Can a single mod cause OutOfMemoryError?
Yes. A mod with a memory leak will consume heap steadily until the server dies, restart, and do it again. The tell is that the crash arrives after a predictable amount of uptime rather than at a particular player count.
Written and maintained by the Hostd engineering team. Last updated 2026-05-23. Notice a mistake? Tell us.