How to give a Minecraft server more RAM

Allocate more RAM to a Minecraft server and fix "OutOfMemoryError: Java heap space": the -Xmx and -Xms flags, memory on a hosted panel, how much RAM each setup needs, and when RAM is not the fix.

  • 1:21 video
  • English captions & transcript
  • 20 October 2026

Transcript

The full narration, chapter by chapter. Click a time to play the video from there.

Intro

Need more RAM for your Minecraft server, or seeing "OutOfMemoryError: Java heap space"? Here's how to fix both.

The error

That error means the server needed more memory than its limit allowed, so Java crashed it.

Xmx and Xms

The limit is set in the start command. -Xmx is the maximum RAM, and -Xms is the starting amount. Set both the same, for example 6G. And always leave one or two gigabytes for the operating system.

On a panel

On a hosted panel, the memory comes from your plan, and the panel applies it for you. To go higher, upgrade the plan, then restart the server.

How much?

How much do you need? Two to four gigabytes for vanilla or Paper. Four to six with plugins and more players. Six to eight for medium modpacks. And eight to ten, or more, for big ones. More isn't always better.

When RAM isn't the fix

If memory keeps climbing until it crashes, no matter how much you give it, a mod or plugin is probably leaking. Lower the view distance, and pre-generate the world. And if the server lags with plenty of free RAM, the bottleneck is the CPU, not memory.

Recap

Quick recap: raise -Xmx, leave room for the system, and match the RAM to your modpack. Minecraft hosting at esagames.ro.

More video tutorials

  • 1:14
    Minecraft

    How to fix "Failed to login: Invalid session" in Minecraft

    Why Minecraft says "Failed to login: Invalid session" and how to fix it: restart the launcher, sign in again for a fresh token, the server-side online-mode check, and what to do if it keeps coming back.

  • 1:51
    Minecraft

    Why can't my friends join my Minecraft server?

    The six reasons friends cannot join your Minecraft server, in the order to check them: the address, port forwarding, the firewall, the version, online mode and the whitelist, and Java vs Bedrock.

  • 1:19
    FiveM

    FiveM stuck on connecting: how to fix it

    Fix FiveM players stuck on "connecting" or a failed handshake: server or client side, UDP 30120, a resource hanging the join, clearing the FiveM cache and other checks.

Skip the troubleshooting

Managed, protected hosting in Frankfurt — we handle the Linux, the network and the DDoS so you don't have to.