[mercury-users] Re: [m-rev.] diff: more hlc.agc fixes

Ralph Becket rafe at cs.mu.OZ.AU
Tue Feb 5 17:20:53 AEDT 2002


Michael Day, Tuesday,  5 February 2002:
> 
> What makes a garbage collector accurate, exactly? It scans a more precise 
> memory range? It doesn't have to scan at all? Is this being done for 
> efficiency reasons?

A conservative GC doesn't know anything about the data that has been
allocated and hence must assume that anything that looks like a pointer
into the heap really is one.  Since it doesn't know what parts of
allocated memory are pointers, it has to test every word that has been
allocated (and on the stack and in the registers...)

An accurate GC knows the type of every item that has been allocated and
therefore only has to scan those parts of each allocated structure (or
stack slots or registers...) that actually are pointers.

An accurate GC can also move data around (i.e. perform heap compaction)
since it can identify all pointers into the heap.  This has a beneficial
effect on allocation which reduces to just incrementing a single heap
pointer, rather than manipulating a free-list of unallocated blocks as
is necessary for conservative GC.

- Ralph
--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list