Minecraft: the server crashes from lack of RAM (OutOfMemory)
Increase Xmx in the Pelican panel and use Aikar's JVM flags to avoid OutOfMemoryError.
Minecraft: the server crashes from lack of RAM (OutOfMemoryError)
The java.lang.OutOfMemoryError: Java heap space error in the console means the JVM has exhausted its allocated memory. The server freezes and then restarts.
Cause / The problem
Either the allocated RAM (-Xmx) is too small for the number of players and mods, or it’s too high relative to the plan’s total RAM (the system kills the process via the OOMKiller).
Solution
- Increase
-Xmxin the Pelican panel → Startup tab → Server Memory Limit field. Set the value based on your server:- Vanilla / 10 players: 2-3 GB
- Paper / 30 players: 4-6 GB
- Heavy modpack: 6-10 GB
- Never exceed 80% of the plan’s RAM. Keep 1 to 1.5 GB for the system and the JVM itself. On an 8 GB plan, allocate 6 GB at most.
- Align
XmswithXmx. Having-Xms=-Xmxavoids heap-resizing pauses. Aikar’s flags recommend this equality. - Use Aikar’s flags to optimize the garbage collector. Grab them from docs.papermc.io/paper/aikars-flags and paste them into the panel’s JVM Arguments field, adjusting the
XmxandXmsvalues. - Cut consumption if you can’t add more RAM:
- Lower
view-distance(immediate 1-2 GB saving). - Reduce the number of preloaded chunks.
- Limit the heavy mods/plugins identified with Spark.
- Lower
- Detect a memory leak. If RAM usage climbs continuously to a crash despite having enough memory, a plugin is leaking. Profile with
/spark healthto see the curve.
Keep an eye on RAM in the panel: it should oscillate and drop after each garbage collection, not climb steadily.