Cheney's algorithm: Difference between revisions

Content deleted Content added
Drj11 (talk | contribs)
edit out the "two finger" phrase
Line 11:
Once all to-space references have been examined and updated, garbage collection is complete.
 
The algorithm needs no stack and only two pointers outside of the from-space and to-space: a pointer to the beginning of free space in the to-space, and a pointer to the next word in to-space that needs to be examined. ForThe thisdata reason,between itthe is sometimes called a "two-finger" collector—itpointers onlyrepresents needswork "tworemaining fingers"for pointing into theit to-space todo keep(those trackobjects ofare its_gray_ state. The data betweenin the twotri-color fingersterminology, representssee work remaining for it to dolater).
 
The forwarding pointer (sometimes called a "broken heart") is used only during the garbage collection process; when a reference to an object already in to-space (thus having a forwarding pointer in from-space) is found, the reference can be updated quickly simply by updating its pointer to match the forwarding pointer.