GC Doctor Analyze garbage collection logs in your browser Analyze your GC log in GC Doctor

Français

Humongous object (G1)

In G1, an object whose size is at least half a region. It is allocated directly in contiguous old regions and bypasses the young generation.

In G1, an object whose size is at least half a region. It is allocated directly in contiguous old regions and bypasses the young generation.

G1 splits the heap into equal regions of 1 MiB to 32 MiB (a power of two chosen from the heap size; -XX:G1HeapRegionSize overrides it). Large arrays, buffers or strings can exceed half a region. They then occupy one or more contiguous regions entirely, and the unused end of the last region is wasted.

This causes three problems: fragmentation (contiguous free regions are needed), early concurrent cycles (a humongous allocation can start a Concurrent Start collection; the log cause is G1 Humongous Allocation) and, when the heap is nearly full of them, evacuation failures or full collections. Dead humongous objects can be reclaimed eagerly during young collections, but long-lived ones stay until a concurrent cycle or a mixed collection frees them.

Remedies: raise the region size, break up large buffers, or reuse them. The Humongous view of GC Doctor lists the collections concerned.

Official documentation: Garbage-First (G1) Garbage Collector (Oracle)

Region

A fixed-size block of the heap. Region-based collectors (G1, ZGC, Shenandoah) reclaim memory region by region instead of as one contiguous generation.

G1 divides the heap into about 2048 regions of equal size (1 MiB to 32 MiB). Each region is given a role as needed: eden, survivor, old or humongous. This lets G1 choose which regions to collect to meet its pause goal. ZGC uses pages of 2 MiB (small objects), 32 MiB (medium) or larger sizes for large objects, and Shenandoah also divides the heap into regions.

A region layout avoids a fixed split between young and old and allows partial compaction. The downside is internal waste when objects do not fill regions, as with humongous objects in G1.

Official documentation: Garbage-First (G1) Garbage Collector (Oracle), The Z Garbage Collector (Oracle)

Humongous object (G1)