Java GC Lag
The server stutters periodically as Java pauses to collect garbage. Long GC pauses freeze the main thread briefly, showing up as recurring lag spikes rather than constant lag.
What does this error mean?
Java reclaims unused memory through garbage collection, which can pause the application. 'High garbage collection' means GC is running often or for long stretches, usually from poor JVM flags, an oversized or undersized heap, or memory churn from mods/plugins.
High garbage collection
Most Common Causes
- Default/poor JVM flags instead of tuned GC settings.
- An oversized heap causing long collection pauses.
- An undersized heap causing constant collection.
- High memory churn from a mod/plugin.
- Allocating nearly all system RAM, starving the OS.
How To Diagnose
- Watch for periodic freezes that line up with GC activity.
- Enable GC logging or use spark to see pause times.
- Review your -Xmx/-Xms and GC flags.
- Check whether RAM usage churns rapidly.
Recommended Fixes
- Apply Aikar's flags
Use the tuned G1GC flags designed for Minecraft to smooth out pauses. - Right-size the heap
Set a heap that fits your need, neither starved nor wastefully huge, leaving RAM for the OS. - Reduce memory churn
Profile and address mods/plugins allocating heavily each tick. - Match Xms to Xmx
Setting them equal avoids costly heap resizing during play.
Frequently Asked Questions
Not necessarily, too much heap lengthens pauses. Tuned flags and a right-sized heap matter more.
A widely used G1GC configuration that greatly reduces GC pauses for Minecraft servers.
GC runs in bursts, so its impact appears as recurring spikes rather than steady lag.