Minecraft java.lang.OutOfMemoryError β€” Definitive Fix Guide

The OutOfMemoryError crash is the most common Minecraft server problem. Here is exactly how to fix it and why it keeps happening.

✨ Summarize This Article with AI:

If your Minecraft server log shows java.lang.OutOfMemoryError: Java heap space, your server has run out of allocated RAM. Java does not automatically use all available RAM β€” you must explicitly allocate it at startup.

Fix: Increase Allocated RAM

Edit your server start command and adjust the -Xmx (max) and -Xms (initial) flags:

java -Xmx4G -Xms2G -jar server.jar nogui

Recommended RAM by Player Count

  • 1–5 players: 2 GB
  • 5–15 players: 4 GB
  • 15–30 players: 8 GB
  • 30+ players: 12–16 GB

Switch to PaperMC for Better Memory Use

Vanilla Minecraft has poor memory management. PaperMC uses significantly less RAM for the same player count. Download from papermc.io and use the same startup flags.

Tired of memory issues?

Our game servers come with the right amount of RAM pre-allocated and PaperMC pre-installed β€” zero configuration needed.

Was this guide helpful?

πŸ˜• Couldn't solve the problem? Contact Our Support Team β†’

πŸ’¬ Leave a Comment