A garbage collector collects a dynamically allocated heap by employing the train
algorithm, in which "car" sections of a heap generation are organized in groups,
or "trains." When a car section comes up for collection, objects that it contains
are evacuated if they are referred to by references located in cars not currently
being collected. The cars to which they are evacuated belong to the trains that
contain the references. The trains form a sequence in which their constituent cars
are to be collected, and objects that are directly allocated in the generation
are placed into trains that precede some existing train in the collection sequence.