Garbage collector and pauses
Why the server freezes for a couple of seconds at normal TPS: how garbage collection works, how to see it in logs, and what actually helps.
Updated August 13, 2026
Java frees memory in pauses: the application stops, the garbage collector removes garbage, and work continues. A long pause looks like a freeze of the entire server.
Symptoms
- Average TPS is normal, but once every few minutes everything freezes for 1–5 seconds.
- In the Paper log:
Can't keep up! Did the system time change, or is the server overloaded?— analysis. spark healthshows the share of time spent in GC.
What affects it
| Factor | Effect |
|---|---|
| Heap size | Larger heap — longer pause |
| Garbage creation rate | Plugins and mods that create objects in a loop |
| Collector | G1 by default; ZGC gives short pauses on large heaps |
| Number of cores | Parallel collection is faster |
What to do
- Don't give memory “with a bigger margin”. 32 GB where 8 is enough means longer pauses. A guideline is peak plus 30–50% — How much memory is needed.
- Find the source of garbage.
spark heapsummarywill show what fills the heap. Often it's a specific plugin or mod. - Flags. A tuned G1 is already set in Millida; manual sets from the internet more often do harm — Aikar's flags.
What not to do
Don't try to “disable the garbage collector” — it doesn't exist as an option. Don't set -Xmx higher than the plan's amount of memory: the process will be killed when it tries to exceed the limit — OutOfMemoryError.
Minecraft hostingYour server runs while you are offlineCreate server
