Weak Arrays
eliot at dcs.qmw.ac.uk
eliot at dcs.qmw.ac.uk
Fri Oct 23 17:45:34 UTC 1992
>mistakes, please) In ParcPlace's Smalltalk 4.0, they started using a gener-
>ational garbage collector (like Self does) and they included a new type of
>collection called a 'WeakArray,' which they use to solve exactly this type
>of problem. A weak array can have objects it references garbage collected
>right out from under it. Weak arrays are also periodically 'informed' when
>their elements die, so that you can do some cleaning up if you want.
>
>I'm sure this kind of thing isn't all that hard to implement (for all I know,
>Self may already have something like this). This would be a usefull addition
>to the wish-list, if it isn't there, though..
>
> -- Bill
I've just implemented weak referees (WeakArray, WeakOrderedCollection etc)
and finalization (objects with a finalize method get sent finalize when they're
about to die) in my deferred reference counting collector. It took three days
to do (because I made some stupid mistakes). If you have a working garbage
collector that you understand and some spare bits in objects (you can usually
shrink the size field) it should be very easy to implement.
I don't like the fact that the ParcPlace scheme
1. indivisibly links WeakArrays & finalization
2. only gives you WeakArray
My scheme keeps weak references and finalization orthogonal, and allows
any object with indexed fields to have weak references if it uses a 'weakAtPut'
primitive in place of the standard weakAtPut.
--
Eliot Miranda, Lecturer email: eliot at dcs.qmw.ac.uk
Department of Computer Science ARPA: eliot%dcs.qmw.ac.uk at nsf.ac.uk
Queen Mary Westfield College UUCP: eliot at qmw-dcs.uucp
Mile End Road, LONDON E1 4NS Tel: 071 975 5229 (+44 71 975 5229)
Fax: 081 980 6533 (+44 81 980 6533)
More information about the Self-interest
mailing list