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

Français

Evacuation failure / to-space exhausted (G1)

G1 could not copy a live object because no free region was left to receive it. The log shows to-space exhausted.

G1 could not copy a live object because no free region was left to receive it. The log shows to-space exhausted.

During a young or mixed collection, G1 copies (evacuates) live objects into free regions. If it runs out of free regions, it cannot move everything: it leaves the objects it could not copy in place, finishes the pause by repairing references and keeps those regions. Such a pause is much longer than usual, and a full collection often follows, the slowest collection of all.

Causes: too little free heap when the collection starts (the concurrent cycle started too late, the allocation rate is high, many humongous objects), or a heap too small for the live data. Remedies: increase the heap, lower -XX:InitiatingHeapOccupancyPercent or leave adaptive IHOP on so that the concurrent cycle starts earlier, raise -XX:G1ReservePercent (10 by default) and reduce humongous allocations.

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

Promotion / Tenuring

Moving an object from the young generation to the old one, because it survived enough young collections or because the survivor space was full.

Each survivor of a young collection gets one year older. The tenuring threshold (-XX:MaxTenuringThreshold, 15 by default) is the age at which objects are promoted. Parallel and G1 lower it dynamically so that survivors fit in the survivor space. When they do not fit, the excess is promoted whatever its age: this is premature promotion.

Promotion has two costs. The object is copied once more, and it will now die in the old generation, where it is reclaimed by a costlier collection. A promotion volume that is high compared with the allocation rate, or old collections that reclaim a lot, suggest that the young generation is too small or that survivors are too large. GC Doctor charts the bytes promoted by each collection.

Remembered set

A structure recording which parts of the heap hold references into a given area, so that this area can be collected without scanning everything else.

A generational collector can collect the young generation alone only if it knows every old object that points into it. Instead of scanning the old generation, it consults the remembered set (a card table in Serial and Parallel, one set per region in G1) that the write barrier maintains.

In G1, remembered sets also allow collecting any subset of old regions, which is what makes mixed collections possible. They are the main memory overhead of G1 (a few percent of the heap, more with many cross-region references), and scanning them takes time in each pause (Scan Heap Roots). Rebuilding them is a concurrent phase after marking (Concurrent Rebuild Remembered Sets).

Evacuation failure / to-space exhausted (G1)