[squeak-dev] Re: Best practice(s) to delete an object?
tim Rowledge
tim at rowledge.org
Wed Feb 27 06:12:47 UTC 2008
I can't help feeling that you're barking up the wrong tree here. If
you have references to some object then by definition it will not get
garbage collected. Once there are no more references, then *poof* away
it goes.
Why are you worrying about objects getting 'deleted'? The only thing
you seem to have said that seems to offer us any useful info here is a
mention of a graph of objects; and the same rule applies - as long as
there are references it must continue to exist. Now you might be
thinking that references within the graph will stop it getting GC'd
but in fact there must be references that trace back to a set of root
objects. If you, for example, made a global and had it be a reference
to one object in a circular linked list then the list would stay
alive. As soon as you set the global to point to some other object
(outside the circle) then the circle would be dead, barring any
contexts on your execution stack having a reference still alive. The
fact that objects in the circle reference one another would not
prevent the garbage collector doing its work.
More explanations of what is worrying you would probably help us to
explain things to you.
tim
--
tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
The best packed information most resembles random noise.
More information about the Squeak-dev
mailing list
|