Copying Garbage Collector (see TT #616) The basic concept of a
Copying Collector is that the heap is divided into two equal
semi-spaces, one of which contains the current data and the
other obsolete data. The Garbage Collection phase starts by
flipping the roles of the two semi-spaces. The collector then
scans the active data in the old semi-space, Fromspace, copying
each live cell into the new semi-space, Tospace. On completion
of the collection phase, Tospace contains all the active data
and Fromspace is effectively abandoned. One major advantage of
this is that the active data is compacted at the bottom of
Tospace. Compacting collectors can allocate space much more
efficiently than collectors in which fragmentation is a problem.
Allocation costs are extremely low. The out-of-space check is a
simple pointer comparison. New memory is acquired by simply
incrementing the free-space pointer. Fragmentation is eliminated
by simply copying the active data into the bottom of Tospace.
The chief drawback of copying c