[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Weak Arrays

My own experience bears out the utility of these things,
but I recall (from the days when I helped Frank Jackson design and implement
the PPS collector) that somehow the existence of weak
pointers cluttered up all the storage management code.
Maybe we just didn't find the cleanest way to do it.


> From urs@otis.Stanford.Edu Fri Oct 23 09:45:08 1992
> Resent-Message-Id: <9210231641.AA00852@otis.Stanford.Edu>
> Subject: Re: Weak Arrays
> To: self-interest@myself.stanford.edu
> Date: Fri, 23 Oct 92 17:45:34 BST
> In-Reply-To: <Yetqg_u0=c_L9fuvAO@cello.ecn.purdue.edu>; from "William R
>         Burdick" at Oct 22, 92 10:01 pm
> X-Mailer: ELM [version 2.3 PL11]
> Resent-To: real-self-interest@otis.Stanford.Edu
> Resent-Date: Fri, 23 Oct 92 9:41:24 PDT
> Resent-From: Urs Hoelzle <urs@otis.Stanford.Edu>
> >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@dcs.qmw.ac.uk
> Department of Computer Science	ARPA:	eliot%dcs.qmw.ac.uk@nsf.ac.uk
> Queen Mary Westfield College	UUCP:	eliot@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)