| Garbage Collection (cont.) |
movethings( heapobject ** root )
{
if ( *root != NULL) {
if ( !(*root)->alreadymoved ) {
move the record **root to new heap
(*root)->forwardingaddress = newposition
(*root)->alreadymoved = TRUE
for all ``child''ren of copied root do
movethings( & child )
}
*root = pointer to new copy of record
}
}
We can easily tell if the "tagged" values are pointers (or not). The return information may look like pointers (i.e. may be odd), but they won't point to the heap, so a simple test against the heap boundaries will detect them.
| Garbage Collection (cont.) |