Skip to content
Pat Host
Servers Free hosting Pricing Guides FAQ About Status Discord Open panel
Home / Guides / Memory and startup flags
Guide

Memory, swap and startup flags explained

Published 28 November 2026

Memory is the resource Minecraft servers run out of most often, and the one people find most confusing. This guide explains what the RAM and swap numbers in the panel mean, roughly how much a server needs, how Java's memory setting is handled for you, and how to tell when memory is the real problem.

RAM and swap

The panel shows two memory figures for your server: RAM and swap. Together they make up the server's memory size.

  • RAM is ordinary memory. It is the fastest, and it is where the busy parts of your server live: loaded chunks, players, entities and plugin data in active use.
  • Swap on Pat Host is compressed memory (zram). Data that has not been used for a while is squeezed and kept in memory in a smaller form. It is much faster than swap on a disk, which is what most people picture when they hear the word, but a little slower than plain RAM, because data has to be unpacked before it is used.

A Java server holds plenty of memory it rarely touches, such as start-up data and old caches. Compressed swap is a good home for that, leaving RAM for what matters every tick.

How your size is split

  • Free servers get 60% of their size as RAM and 40% as swap. A 5 GB free server has 3 GB of RAM and 2 GB of swap.
  • Paid servers get RAM and swap in a ratio of 100 to 50, adding up to the plan size. A 6 GB plan has 4 GB of RAM and 2 GB of swap.

How much memory does a server need?

There is no exact answer, because memory use depends on what players do far more than on the software. The figures below are rough general guidance from the Minecraft community, not Pat Host limits:

  • Vanilla or Paper with a few friends: around 2 to 3 GB is usually comfortable.
  • A plugin server with a handful of common plugins and a small community: around 4 to 6 GB.
  • A light modpack of a few dozen mods: around 4 to 6 GB.
  • A large modpack with a hundred or more mods: often 8 GB or more. Check the pack's own page, as many packs state what they need.

What pushes memory up the most:

  • Loaded chunks. Every player keeps an area around them loaded. Players spread out across the map use far more memory than players in one base. View distance and simulation distance in server.properties control the size of that area.
  • Entities. Big mob farms, item piles and thousands of animals.
  • Exploring new land. Generating chunks is heavy. Pre-generating the world with a plugin such as Chunky, while nobody is online, moves that work out of play time.
  • Plugins and mods that keep a lot in memory, such as web maps.

The Java heap is set for you

Java programs have a heap, the area where the program keeps its objects, and a maximum size for it set by the -Xmx flag. On Pat Host the startup command sets -Xmx automatically to 90% of your server's RAM plus swap. On a 6 GB server that is about 5.4 GB of heap.

The other 10% is not wasted. Java needs memory outside the heap for its own work: the compiled code, loaded classes, thread stacks, network buffers and the garbage collector's bookkeeping. Leaving room for that is what stops the server being killed when it is busy.

Why a bigger -Xmx crashes the server

It is tempting to raise -Xmx in the hope of more memory. It does not work. Your server has a fixed limit, and -Xmx only tells Java how much it may ask for. If Java is allowed to grow past what the server actually has, the server is stopped the moment it goes over, with no warning and often no error in the log. It looks like a random crash, usually at the busiest moment.

Leave the automatic heap alone. If the server genuinely needs more memory, give it a bigger size instead; see below.

Aikar's flags

Java frees memory with a garbage collector, which every so often finds objects nobody uses any more and clears them. If it pauses the server for too long while doing that, players feel it as a lag spike. Aikar's flags are a well-known set of Java settings, written by a Paper developer, that tune the G1 garbage collector for the way Minecraft uses memory. Among other things they:

  • use the G1 collector and aim for short pauses (-XX:MaxGCPauseMillis=200);
  • give more of the heap to short-lived objects (G1NewSizePercent, G1MaxNewSizePercent), because Minecraft creates huge numbers of objects that are thrown away within a tick;
  • start cleaning up earlier (InitiatingHeapOccupancyPercent), so the collector is not forced into one big, slow clean-up;
  • stop plugins from forcing a full collection (-XX:+DisableExplicitGC).

Aikar's flags are allowed on Pat Host. The startup command has parts the platform needs, including the automatic heap and the crossplay settings, so please do not paste a flag line from the internet over it. Open a ticket in our Discord and ask for Aikar's flags, and staff will merge them with the required parts.

Keep expectations realistic: the flags smooth out garbage collection pauses. They do not give a server more memory, and they do not fix lag caused by a heavy plugin or a giant farm.

Signs of memory trouble

  • The console shows java.lang.OutOfMemoryError, often with "Java heap space". The heap filled up completely.
  • The server stops suddenly with no crash report while people are on, and the console just ends. That is the pattern of a server going over its limit.
  • Regular lag spikes every few seconds or minutes, even with few players, that line up with garbage collection.

One thing that is not a sign of trouble: memory usage that looks high in the panel. Java takes memory and keeps hold of it rather than giving it straight back, so a healthy server often sits near the top of its heap. Judge by the symptoms above, not by the number alone.

Finding the cause with spark

spark is a free profiler for Minecraft servers, available as a plugin and as a mod. Recent Paper builds include it already; on other servers, install it from the plugins or mods tab. Useful commands:

  • /spark health shows TPS, tick times, memory and CPU at a glance.
  • /spark gc shows how often the garbage collector runs and how long it pauses.
  • /spark profiler start, then /spark profiler stop a few minutes later, gives you a link to a report showing which plugins, mods or entities use the most time.

Run the profiler while the problem is happening. A spark link is also the most useful thing to attach to a support ticket.

Common problems

  • The server dies when several players explore. Lower view distance or simulation distance, and pre-generate the world.
  • I changed -Xmx and now it crashes. Put the startup command back to the automatic heap.
  • A modpack will not finish starting. It may simply need more memory than the server has. Check the pack's stated requirement; see installing mods.
  • The server needs more memory. Free servers can be resized in the Settings tab within the free limits; see creating a free server. Remember that larger free servers sleep sooner; see server sleep and wake-up. For more than that, see the paid plans.
  • Lag after adding plugins. Remove the newest one and test again; see installing plugins.
Pat Host

Free Minecraft, Mindustry and bot servers in the UK, Australia and Canada, paid plans there and in Texas, and one hub address for every server: play.pathost.xyz.

Pat Host

  • Server browser
  • How the hub works
  • Free hosting
  • Guides
  • About Pat Host
  • Panel

Paid plans

  • Plans
  • Custom plan
  • How to order
  • FAQ

Help

  • FAQ
  • Contact
  • Discord
  • Server status
  • Terms of Service
  • Privacy Policy
© 2026 Pat Host Not an official Minecraft product. Not approved by or associated with Mojang or Microsoft.