When objects are promoted from generation 0 to 1, and there is not enough space in generation 1, the GC tries to free space in generation 1. The first step is to check if sufficient space can be freed by promoting the objects marked for promotion. If this is the case the GC promotes these objects from generation 1 to generation 2. (In practice, this rarely happens.) If this check fails the GC marks and sweeps generation 1. If not enough space is freed by this mark-and-sweep, than either all the objects in generation 1 are promoted, or generation 1 is expanded. This is controlled by
, which specifies whether expansion or promotion takes place.
If generation 1 is expanded, the amount it tries to expand by is the value
) in words (i.e. multiples of 4 bytes), or the amount of free space needed, whichever is bigger. If
is 0, it is not expanded. In this case part of the objects marked for promotion are not promoted.