Related articles |
---|
Copying GC and finalization der_julian@web.de (Julian Stecklina) (2005-07-26) |
Re: Copying GC and finalization cjc1@cam.ac.uk (Chris Cheney) (2005-07-28) |
Re: Copying GC and finalization liekweg@gmx.de (Florian Liekweg) (2005-07-28) |
Re: Copying GC and finalization der_julian@web.de (Julian Stecklina) (2005-08-05) |
Re: Copying GC and finalization eliotm@pacbell.net (Eliot Miranda) (2005-08-21) |
Re: Copying GC and finalization der_julian@web.de (Julian Stecklina) (2005-08-24) |
From: | Julian Stecklina <der_julian@web.de> |
Newsgroups: | comp.compilers |
Date: | 5 Aug 2005 18:13:15 -0400 |
Organization: | Compilers Central |
References: | 05-07-105 05-07-116 |
Keywords: | GC |
Posted-Date: | 05 Aug 2005 18:13:15 EDT |
Chris Cheney <cjc1@cam.ac.uk> writes:
> Julian Stecklina <der_julian@web.de> wrote in news:05-07-105@comp.compilers:
>> I am looking for ways to implement finalization of and weak pointers
>> to objects in a copying garbage collector. I am quite puzzled on how
>> to implement this without losing the nice property of copying garbage
>> collectors that there is nothing to do for objects that have become
>> garbage.
>
> Nothing to do except finalize them!
>
> One (naive) way is to give all objects a hidden field ('hidden' meaning that
> the garbage collector doesn't use it to find objects). I assume that the
> type of the object is determinable when the object is accessed from the
> hidden list.
>
> 1. When an object is created, chain it to a 'list of all current objects'
> using this field.
>
> 2. When an object is found and copied by the garbage collector, unchain it
> from the 'list of all current objects' and chain it to a 'temporary list'.
Without making this a doubly-linked list (and wasting another word)
this is an O(n) operation. It seems like it should be possible to
restrict this book-keeping to objects that actually have a finalizer
attached to them, thus (due to the small number of objects in need of
finalizing) the time spent modifying the list should be quite
small. Nevertheless it destroys the possibility of having a GC that
meets real-time properties.
> Now what about the weak pointers ...
In a stop-and-copy GC it should be possible to scan through all
objects containing weak-pointers after the actual collection and
replace every pointer to from-space by NIL or #f or something.
> HTH
Yes, it does. Thanks.
Regards,
--
Julian Stecklina
Return to the
comp.compilers page.
Search the
comp.compilers archives again.