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

Tyson Dowd trd at cs.mu.OZ.AU
Thu Feb 7 12:14:03 AEDT 2002


On 05-Feb-2002, Zoltan Somogyi <zs at cs.mu.OZ.AU> wrote:
> 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.

They also have the advantage in logic programming that since new memory
can be arranged to be allocated sequentially, backtracking can
deallocate memory very efficiently, since when the system backtracks
the entire top of the heap can simply be discarded (up to the last
allocation before a choice point).

-- 
       Tyson Dowd           # 
                            #  Surreal humour isn't everyone's cup of fur.
     trd at cs.mu.oz.au        # 
http://www.cs.mu.oz.au/~trd #
--------------------------------------------------------------------------
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