Minecraft has a bunch of startup flags for JVM, which contains a bunch of disabled features that could be useful or unlocks cool experimental features that a normal Minecraft client doesn’t have (eg. custom debug flags for developers)
I will only introduces some flags that are commonly used for optimization and performance and maybe useful for some use cases.
Before using it: Most of those flags are intended for development or debugging purposes, do not use these flags for normal uses.
Terminology
JVM – Java Virtual MachineGC – Garbage Collector, a program feature where it would automatically clean unused memory, usually in low level programming you would have to manually allocate and free memory, and memory is very fragile.
Common uses (latest)
Those are the flags that are officially used by Mojang for Java SE 25:-Xms2G -Xmx4G – Allocate 2GB of memory for initial startup and use the maximum of 4GB of memory, mapping memory like this to prevent unpredictable memory allocation.-XX:+UseStringDeduplication – Reduces heap memory usage by finding original strings and any duplicate strings will be a pointer to the original stringXX:+AlwaysPreTouch – Fully use 4GB of system memory at startup for consistent latency (aka reducing lag spikes), and improves predictable memory allocation-Ddiscordfix="net.minecraft.client.main.Main" – Additional flags for displaying game status on Discord, mainly used when using unofficial launcher instead of Mojang’s official launcher.
-XX:+UseZGC – Use the Z garbage collector (added as experimental flags -XX:+UnlockExperimentalVMOptions -XX:+ZGenerational in Java SE 21 and 22, officially used on Java SE 25), worth noting is that this GC designed for mid-end and high-end computer with its conservative and passive memory handling for computer with high amount of allocated memory, not ideal for low allocated memory and CPU performance.