Skip to content
CubeVote

Startup flags and RAM

The line that starts your server decides its memory and how its garbage collector behaves, the top cause of “lag” for no reason. Pick the software and the memory: the command, start.sh and start.bat are ready to copy.

Server software

Server software

6 GB
How much memory do I need?

Estimate: 6 GB.

A rough figure: view distance matters more than the number of plugins, because loaded chunks grow with its square.

Required Java: Java 21: Java 21 since 1.20.5.

Java command

Paste as is in a terminal, or in the “startup” field of a panel like Pterodactyl.

java -Xms6G -Xmx6G -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true -jar paper.jar --nogui

start.sh: Linux and macOS

Put it in the server folder. Run it inside screen or tmux so it survives closing the terminal.

#!/usr/bin/env bash
# Startup script generated on cubevote.net/en/tools/startup-flags
# Make it executable once: chmod +x start.sh
cd "$(dirname "$0")"

while true; do
  java -Xms6G -Xmx6G -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true -jar paper.jar --nogui
  echo "Server stopped. Restarting in 10 seconds: Ctrl+C to cancel."
  sleep 10
done

start.bat: Windows

Double-click to start. Saved with Windows line endings.

@echo off
rem Startup script generated on cubevote.net/en/tools/startup-flags
cd /d "%~dp0"
:demarrer
java -Xms6G -Xmx6G -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true -jar paper.jar --nogui
echo Server stopped. Restarting in 10 seconds - Ctrl+C to cancel.
timeout /t 10
goto demarrer

Good to know

  • -Xmx sets the Java heap, not the whole process memory: the JVM takes a bit more. With a host selling “8 GB”, allocate 7.
  • Aikar's flags are the ones PaperMC's documentation recommends. They also suit Vanilla, Fabric and Forge.
  • More memory doesn't mean smoother: a Minecraft server runs each world on a single core. Beyond what it uses, extra memory does nothing.

Guides to go further

In the same toolbox