Minecraft Java startup flags generator
Aikar's flags, with the values that change above 12 GB handled for you.
java -Xms4G -Xmx4G -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
On a hosted server
If your panel already sets the memory, add only the -XX and -D options where it allows extra flags. Do not allocate more than your plan provides.
Questions
What are Aikar's flags?
A widely used set of Java G1 garbage collector options tuned for Minecraft servers, published by the Paper community contributor Aikar.
Should Xms equal Xmx?
These flags assume yes: the memory is reserved once at startup, which avoids resizing during play.
Can I use all of my machine's memory?
No. Leave room for the system and for memory Java uses outside the heap, commonly 1 to 1.5 GB.