Figure 6-7. Concurrent collection performed by G1
The are three important things to observe in this diagram. First, the young generation has
changed its occupancy: there will be at least one (and possibly more) young collections dur-
ing the concurrent cycle. Hence, the eden regions before the marking cycle have been com-
pletely freed, and new eden regions have started to be allocated.
Second, some regions are now marked with an X. Those regions belong to the old generation
(and note that they still contain data)—they are regions that the marking cycle has determin-
ed contain mostly garbage.
Finally, notice that the old generation (consisting of the regions marked with an O or an X) is
actually more occupied after the cycle has completed. That's because the young generation
collections that occurred during the marking cycle promoted data into the old generation. In
addition, the marking cycle doesn't actually free any data in the old generation: it merely
identifies regions that are mostly garbage. Data from those regions is freed in a later cycle.
The G1 concurrent cycle has several phases, some of which stop all application threads and
some of which do not. The first phase is an initial-mark phase. That phase stops all applica-
tion threads—partly because it also executes a young collection: