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

Zoltan Somogyi zs at cs.mu.OZ.AU
Tue Feb 5 17:23:40 AEDT 2002


On 05-Feb-2002, Michael Day <mikeday at bigpond.net.au> wrote:
> What makes a garbage collector accurate, exactly?

A conservative collector assumes that any memory location holding a bit
pattern that is the same as the address of an allocated memory block may be
a pointer to that memory block, which means that the block (and other blocks
it points to) cannot be garbage collected. However, since the memory location
may simply hold an integer or a string as well as a pointer, the block cannot
be moved either. Consider what would happen if the collector did move the
block. If the location contains a pointer to the block, the collector *must*
update its contents; if the location contains anything else, the collector
*must not* update its contents.

An accurate collector knows exactly which blocks contain pointers.
Its main advantage over a conservative collector is that it need never
retain a memory block just because an integer or string in the program
has a bit pattern that looks like that block's address.

> Is this being done for efficiency reasons?

Efficiency is a secondary target; important, but not as important as avoiding
unnecessary memory retention.

Zoltan.
--------------------------------------------------------------------------
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