// crash guide

Minecraft server crash: out of memory

java.lang.OutOfMemoryError: Java heap space means the server filled all the memory Java was allowed to use and couldn’t free enough to keep going. Usually the limit is too small for the modpack, or it isn’t being applied at all.

Updated  ยท  Forge, NeoForge, Fabric, Quilt

What the error looks like

Open the newest file in crash-reports/ (named like crash-2026-10-04_14.22.31-server.txt):

---- Minecraft Crash Report ----
// Ouch. That hurt :(

Time: 2026-10-04 14:22:31
Description: Exception in server tick loop

java.lang.OutOfMemoryError: Java heap space

Not every out-of-memory crash leaves a crash report. If there isn’t one, search logs/latest.log for OutOfMemoryError (Forge and NeoForge also write logs/debug.log). The start of each line (time stamp, logger name) differs by loader, but the message is the same:

[Server thread/ERROR]: Encountered an unexpected exception
java.lang.OutOfMemoryError: Java heap space

If it happens during startup or on another thread, the error can sit inside a longer stack trace, on a line like one of these:

Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
Caused by: java.lang.OutOfMemoryError: Java heap space

The text after the colon can also be:

java.lang.OutOfMemoryError: GC overhead limit exceeded
java.lang.OutOfMemoryError: Metaspace
java.lang.OutOfMemoryError: unable to create native thread: possibly out of memory or process/resource limits reached
java.lang.OutOfMemoryError: unable to create new native thread

Before it crashes, the console often fills with Can't keep up! Is the server overloaded? warnings. If Java stalls long enough, the watchdog may stop the server first, so look for OutOfMemoryError above a watchdog crash too.

What it means

Java keeps the server’s game data in an area of memory called the heap. The -Xmx flag sets the most it can grow to. Every loaded chunk, mob, item and mod registry lives there. When the heap is full and garbage collection can’t free enough, Java throws OutOfMemoryError and the server stops.

MessageWhat ran out
Java heap spaceThe heap. This is the common one.
GC overhead limit exceededThe heap again. Java spent nearly all its time collecting garbage and freed almost nothing. Most often seen on Java 8. Same fixes.
MetaspaceMemory for loaded classes (game and mod code), separate from the heap. It has no limit by default, so this almost always means a -XX:MaxMetaspaceSize flag is set too low.
unable to create (new) native threadNot the heap. The system refused another thread, because of a process limit or no memory left outside the heap. More -Xmx won’t help.

For “Java heap space”, the usual causes are:

No error at all, the server just stops (on Linux, often with exit code 137)? The whole Java process probably went over the server’s memory limit and the system killed it. That usually happens because -Xmx equals the plan’s RAM and leaves no room for Java’s own overhead.

Common in these packs: the biggest ones, like All the Mods 10 (around 500 mods), Craft to Exile 2 (397 listed on CurseForge) and FTB StoneBlock 4 (388 on the server), when the server runs on Java’s default memory or too small a plan.

How to fix it

  1. Check the heap the server really had. In the crash report, under -- System Details --, the Memory: line ends with “up to” and the max heap. JVM Flags: lists the flags Java actually got. If “up to” is far below what you set, your -Xmx isn’t being read.
  2. Set -Xmx where the start command reads it.
    • Folder has run.sh / run.bat and user_jvm_args.txt (Forge 1.17+ and NeoForge): add a line like -Xmx6G to user_jvm_args.txt. Lines starting with # are ignored, so either delete the # in front of the example -Xmx line or add your own line below it.
    • You start it with java -jar (older Forge, Fabric, Quilt): put the flags before -jar, with your jar’s real name:
      java -Xms6G -Xmx6G -jar fabric-server-launch.jar nogui
    • Pelican panel (what DSN uses): the startup command and Java image are shown on the Startup tab. The command may call Java directly, so user_jvm_args.txt only counts if the command includes @user_jvm_args.txt. Some panel commands use -XX:MaxRAMPercentage instead of -Xmx, which sizes the heap as a share of the server’s memory limit. An explicit -Xmx overrides it. If you can’t edit the command, ask your host.
    Use one -Xmx. If there are two, Java uses the last one.
  3. Pick a sensible size. Light packs need about 6 GB, medium about 8 GB, and heavy kitchen-sink packs like All the Mods 10 need 10–12 GB. The pack’s own recommendation is usually right. Leave 10–15% of the plan for Java’s overhead: on an 8 GB plan, use -Xmx7G, not -Xmx8G. If the pack needs more than the plan has, no flag fixes that, including Aikar’s GC flags. More in how much RAM a modded server needs.
  4. Cut the spikes. Pre-generate the world with Chunky while nobody is online: /chunky center 0 0, /chunky radius 3000, /chunky start. Then /worldborder set 6000 keeps players inside it. In server.properties, dropping view-distance from 10 to 8 cuts loaded chunks per player by about a third. Clear out farms that pile up items or mobs.
  5. Remove client-only mods. Minimaps, shader loaders, HUD and sound mods have no job on a server. Some get skipped, some load anyway and waste memory, and some crash it. Use the pack’s server files instead of a copy of your client mods folder.
  6. If memory keeps climbing, find the leak. Install the spark mod and run /spark heapsummary when memory is high. It lists what is filling the heap. If one mod’s classes (their names usually include the mod’s name) sit near the top, that mod is the likely cause. Update or remove it. Until then, a daily restart from the panel’s scheduled tasks can keep the server running.
  7. For the other messages:
    • Metaspace: remove -XX:MaxMetaspaceSize from your flags, or raise it a lot.
    • Native thread: lower -Xmx a little to give the system room. On a hosted server, send your host the log; process limits are set on their side.
    • Killed with no error: lower -Xmx so the whole process fits inside the plan.

Different error: Could not reserve enough space for object heap (newer Java puts the size in the middle, like for 4194304KB object heap) means Java couldn’t start with the -Xmx you asked for. Lower it, or use 64-bit Java.

How to check it’s fixed

  1. Stop the server fully, then start it. Flags are only read when Java starts.
  2. Run /spark health and check the memory line shows the new maximum.
  3. Watch memory with players online. A sawtooth of rising and falling is normal. If the low point after each drop keeps rising for hours, go back to finding the leak.
  4. Stress it: fly through new terrain or run a Chunky pregen. A day of normal play with no OutOfMemoryError in logs/latest.log is a good sign it’s fixed.

The panel’s memory graph counts the whole Java process, so it reads higher than the heap. With -XX:+AlwaysPreTouch (in Aikar’s flags) it sits near full from startup. That’s normal.

Not sure this is your crash?Paste your log into the free crash log analyzer. It spots this and other common modded crashes and explains the fix in plain English.

Related crash guides

Modded hosting is relaunching.

We're moving DSN Servers to new hardware, and ordering is closed until then. At the prices we plan to relaunch with, Standard is 4 GB for $16 a month, Premium 8 GB for $30 and Heavy 12 GB for $42, and each pack guide says which one we’d pick. Join the launch list and we'll email you when servers open.

Join the launch list