Cheney's algorithm: Difference between revisions

Content deleted Content added
Drj11 (talk | contribs)
edit out the "two finger" phrase
Drj11 (talk | contribs)
m fix formatting
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. The data between the two pointers represents work remaining for it to do (those objects are _gray_''gray'' in the tri-color terminology, see later).
 
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.