- 3 minutes to read

Supported Garbage Collectors

The Nodinite JMX Monitoring Agent works with JVMs that use any garbage collector. The agent doesn't monitor garbage collection itself: it reads no GC counts, pause times, or GC overhead. It monitors CPU and free heap (Configuration), and because the garbage collector decides how free heap rises and falls, the collector matters when you set the Heap Size thresholds and Duration.

Garbage Collectors and Heap Behavior

Every standard JVM garbage collector reports heap memory over JMX, so the agent can read free heap whichever collector you use:

Garbage Collector JVM Flag Behavior Best For
G1GC (Garbage First) -XX:+UseG1GC Concurrent, low-pause, region-based Most modern workloads (JDK 9+ default)
ZGC -XX:+UseZGC Ultra-low pause, concurrent compacting Latency-sensitive applications (JDK 15+)
Shenandoah -XX:+UseShenandoahGC Concurrent evacuation, low pause OpenJDK builds (JDK 12+)
ParallelGC -XX:+UseParallelGC Throughput-focused, stop-the-world Batch processing workloads
SerialGC -XX:+UseSerialGC Single-threaded, simple Small JVMs, single-core environments
CMS -XX:+UseConcMarkSweepGC Concurrent mark-sweep ⚠️ Legacy JVMs (deprecated in JDK 9, removed in JDK 14)

Tip

Check which garbage collector your JVM uses by running: java -XX:+PrintFlagsFinal -version | grep UseG1GC

How Garbage Collection Affects Free Heap

Free heap falls as the application allocates objects and rises again when the collector frees them. A short dip in free heap is normal; free heap that stays low after collections is the real risk.

graph TD A["fa:fa-play Application allocates objects
Free heap falls"] --> B["fa:fa-recycle Garbage collection runs"] B --> C{"Free heap recovers?"} C -->|"Yes"| OK["fa:fa-circle-check OK
Normal sawtooth pattern"] C -->|"Stays low for Duration"| W["fa:fa-triangle-exclamation Warning or Error
Free heap below threshold"] W --> OOM["fa:fa-circle-xmark OutOfMemoryError risk
if nothing changes"] OK --> A style OK fill:#93d16d style W fill:#FFD525 style OOM fill:#c33d34

Diagram: Garbage collection makes free heap rise and fall. Green OK while free heap recovers after each collection; yellow Warning or Error when free heap stays below the Heap Size threshold for the Duration; red when an OutOfMemoryError becomes likely.

Heap Size Thresholds by Garbage Collector

The Heap Size thresholds are the minimum free heap in percent: the Resource changes state when free heap drops below them for the Duration. Start from these values and adjust after watching your own JVMs:

GC Type Heap Volatility Warning (free heap below) Error (free heap below) Duration
G1GC / ZGC / Shenandoah Low (concurrent GC keeps heap stable) 30% 20% 60–120 s
ParallelGC Medium (stop-the-world frees heap in bursts) 25% 15% 120–300 s
SerialGC High (single-threaded GC, longer pauses) 35% 25% 120–300 s
CMS (legacy) Medium (concurrent but can fragment) 30% 20% 120 s

Note

For collectors with high volatility (SerialGC, ParallelGC), a longer Duration keeps the Resource from changing state during the normal dip before each collection.

The heap state changes repeatedly during batch jobs. What should I do?

Increase the Duration on the Heap Size tab in the Configuration so free heap must stay low for longer before the state changes. For batch jobs, 300–600 seconds is typical.

Why does free heap drop to 5% and then jump back?

This is normal for ParallelGC and SerialGC, which run stop-the-world collections. The heap fills until a major collection runs, then free heap jumps back. Use the Duration setting to ignore these expected dips.

Can Nodinite alert on GC overhead or GC pause times?

No. The JMX Monitoring Agent doesn't read garbage collection metrics. To investigate GC behavior, use JVM tools: enable GC logging with -Xlog:gc* (JDK 9+), watch live collector statistics with jstat (jstat -gcutil <PID> 5000), or connect JConsole to the JVM. Low free heap that never recovers, which the agent does alert on, is often the first sign of GC pressure or a memory leak.

Next Steps

Correlate Heap Spikes
Environment-Specific Thresholds

Heap Used vs Committed
JMX Troubleshooting Overview
JMX Monitoring Agent