A garbage collector collects at least a generation of a dynamically allocated
heap
in increments. In each increment, it identifies references located outside a collection
set that refer to objects that belong to the collection set, and it evacuates the
objects thus referred to before it reclaims the memory space that the collection
set occupies. In some collection increments, references to collection-set objects
are located both inside and outside the generation. The collector locates all such
references, both those inside the generation and those outside it, before it evacuates
any objects in response to any of them. By doing so, it is able to reduce the cost
of locating references and evacuating objects.