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.