Memory & JVM Arguments Guide — The Technical Answer to Stutter in Large Modpacks
In big modpacks, "it freezes for a second out of nowhere" usually traces back to JVM garbage-collection pauses. Sizing your heap, applying Aikar's Flags (the G1GC tuning set), when ZGC — vanilla's new default in 2026 — is actually the better pick, matching Java versions, and which performance mods to pair.
📑 Contents (10 sections)
- Why Adding RAM Alone Isn't the Answer
- Step 1 — Sizing RAM Allocation
- Step 2 — Applying Aikar's Flags
- Step 3 — Allocating 12GB or More
- Step 4 — Matching the Java Version
- Step 5 — Performance Mods Worth Pairing
- Step 6 — What to Actually Measure
- Common Symptoms and What to Check
- Closing
- Related Reading
Why Adding RAM Alone Isn't the Answer
The recurring question about ATM10/DarkRPG-class packs is "I gave it 16GB, why does it still stutter?" A bigger heap also means more for the garbage collector to walk on each cycle. How the JVM manages that memory matters as much as how much you hand it.
This guide is the technical follow-up to the [Performance Optimization Guide](/en/guides/performance-optimization/), focused on JVM arguments.
Step 1 — Sizing RAM Allocation
Rough guidance by pack size
| Modpack size | Suggested allocation | Suggested PC RAM | |---|---|---| | Vanilla+ (10–30 mods) | 4–6 GB | 8 GB | | Medium (50–150 mods) | 6–8 GB | 16 GB | | Large (200+ mods) | 8–12 GB | 16 GB or more |
Principle: always leave the OS its share
On a 16GB PC, 8–10GB to the modpack is a sane range. Leave roughly 6GB for the OS, browser, and Discord. Once the system runs short, it starts swapping to disk and everything slows down regardless of what you allocated.
Where to set RAM
Step 2 — Applying Aikar's Flags
What Aikar's Flags are
Aikar's Flags is a published G1GC tuning set of JVM arguments from Aikar of the Paper server project. The core idea is to keep any single GC pause short by adjusting the Young Generation ratio and when concurrent marking starts. It's effectively the standard for Minecraft server hosting.
The set was written for servers, and it's commonly pasted into clients (including singleplayer) as well. Actual benefit varies by machine and pack — compare stutter before and after and judge for yourself.
The full argument set (copy-paste)
-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
What the main flags do:
-XX:+UseG1GC — use the G1 garbage collector-XX:MaxGCPauseMillis=200 — target a 200ms GC pause (a goal, not a guarantee)-XX:+AlwaysPreTouch — commit heap pages at startup; slightly slower launch, steadier allocation afterwards-XX:+DisableExplicitGC — ignore System.gc() calls from code (they force full pauses)-XX:G1NewSizePercent / G1MaxNewSizePercent — Young Generation size range-XX:InitiatingHeapOccupancyPercent — heap occupancy that triggers concurrent markingThe last two (-Dusing.aikars.flags, -Daikars.new.flags) are marker system properties and don't change behavior.
Aikar's guidance also says to set -Xms equal to -Xmx (e.g. -Xms8G -Xmx8G).
Where to enter them
Step 3 — Allocating 12GB or More
Aikar's documentation says to adjust these values when allocating 12GB+:
-XX:G1NewSizePercent=40 (up from 30)-XX:G1MaxNewSizePercent=50 (up from 40)-XX:G1ReservePercent=15 (down from 20)-XX:InitiatingHeapOccupancyPercent=20 (up from 15)The direction is the same: on a large heap, a bigger Young Generation means fewer collections.
When to consider ZGC
2026 added an option. Mojang switched vanilla's default collector from G1GC to ZGC starting with the 26.1 snapshots.
That's the official launcher's default for vanilla, though — it is not a signal to stop using Aikar's Flags on modpacks. It depends on the case.
| Situation | Recommendation | |---|---| | Modpack (1.20.1, 1.21.1 …) with 6–12GB | Aikar's Flags (G1GC) — Step 2 as written | | 26.x vanilla via the official launcher | Nothing to do — the launcher already uses ZGC | | Large modpack with 16GB+ allocated | Worth testing ZGC |
On a large heap ZGC is strong at keeping pauses short. At 6–8GB, G1GC is often the more efficient choice, so switching isn't automatically an improvement. Measure before and after — if you can't feel a difference, switch back.
⚠️ ZGC and Aikar's Flags cannot be combined. Aikar's Flags are a bundle built around-XX:+UseG1GCand the-XX:G1...family. Moving to ZGC means deleting all of them and using the set below. Mixing the two gets the G1 options ignored, or a JVM warning.
The ZGC flags differ by Java version. Getting this wrong stops the game from launching.
-Xmx8G -Xms8G -XX:+UseZGC -XX:+ZGenerational-Xmx8G -Xms8G -XX:+UseZGCGenerational ZGC became the default in Java 23, which deprecated -XX:+ZGenerational, and Java 24 removed the flag entirely — passing it on 24+ does nothing. On Java 21, omitting it leaves you on the older non-generational ZGC.
Step 4 — Matching the Java Version
Required Java by Minecraft version
Too low a version and the game won't start at all — you'll get UnsupportedClassVersionError. The G1GC flags above are standard HotSpot options (Adoptium, Zulu, Oracle), so they carry over unchanged between Java 17 and 21. Note that Minecraft 26.1 raised the minimum to Java 25, and that the official launcher defaults to ZGC in that band.
What launchers handle for you
The CurseForge and Modrinth apps fetch and use the Java runtime the pack asks for. Launchers that set Java per instance (Prism) need you to point at the right JDK yourself.
Step 5 — Performance Mods Worth Pairing
JVM flags only touch GC behavior. Cutting rendering cost and memory usage itself is the mods' job. Many packs already ship these — check your mods folder before adding duplicates.
Step 6 — What to Actually Measure
The F3 debug screen
Press F3 in-game: the right side shows FPS and memory used / allocated. If usage sits pinned against the allocation, GC is running often and there's room to raise the allocation. If there's plenty of headroom and it still stutters, the cause isn't memory — it's rendering or tick load.
[Memory Usage Title](/en/mods/memory-usage-title/)
A tiny mod that prints memory usage in the Minecraft window title bar. Useful when you want to watch the trend without keeping F3 open. It only displays — it doesn't free anything.
Common Symptoms and What to Check
"Memory has headroom but it freezes for a second periodically"
GC pauses are the likely cause. Apply Aikar's Flags and set-Xms equal to -Xmx."OutOfMemoryError during startup"
Either the allocation is too small, or you're on 32-bit Java (which caps the heap severely). Confirm 64-bit Java, then raise the allocation."FPS itself is low"
JVM flags won't fix this. Look at render distance, graphics options, and rendering optimization mods — see the [Performance Optimization Guide](/en/guides/performance-optimization/)."Stutters when moving into new chunks"
That's chunk generation plus disk I/O. Put the instance on an SSD and lower render/simulation distance first.Closing
The order is simple: size the allocation sensibly (leave the OS its share) → add Aikar's Flags → match the Java version → check your performance mods. If it still stutters after that, it probably isn't GC — move on to diagnosing rendering and tick load.
Related Reading
📦 Related Modpacks
All the Mods 10
The latest in the ATM series. A massive kitchen-sink modpack with over 400 mods to freely explore. Built on 1.21 NeoForge for the newest content available.
🎯 Best for A good fit if you want automation, magic, and exploration all in one pack.
DarkRPG
A full-on RPG modpack combining vampires, dragons, magic, and quests. Epic Fight parry combat and a deep boss roster create a fresh progression rhythm.
🎯 Best for A fit for family players who enjoy boss-hunting quests and parry-based action RPG combat.
COBBLEVERSE - Pokemon Adventure
A full-scale Pokémon adventure modpack built on Cobblemon. Experience an Pokémon RPG within Minecraft — complete with gym battles, evolution, and trainer fights.
🎯 Best for Suits players who want an Pokémon RPG (gym battles, trainers) over automation.