[Newbies] Proper object removal

Herbert König herbertkoenig at gmx.net
Wed Jun 4 04:45:41 UTC 2008


Hello Rob,


RR> After much help already, I think I need some training in proper object removal.

RR> DataAbstractor allInstances.

if you inspect this you get an inspector on an Array. To the left
select any entry with a left click (on Windows) and select "objects
pointing to this value". You get another inspector with an array of
the objects pointing to the object you can't delete.

Again inspecting one of these objects you can see how it points to
your original object. This might give you a clue. And manually
deleting these references (setting them to nil in the inspector) will
eventually free your original object for garbage collection.

If some of the objects you find are WeakArray or such you are in the
(to me) murky area of finalization and weak references. Squeak dev
would be the place to ask.

You don't state the size of your problem. Is it three or is it
thousands of instances hanging around?.

I once tried the pointer finder tool but wasn't satisfied with it.

And the swiki has a page on "cleaning up junk".

RR> I still see the object I removed, even with an explicit
RR> Smalltalk garbageCollect or garbageCollectMost. 

RR>  Anything I create seems to hang around forever.

Sometimes saving and reloading an image does a more thorough job than
garbageCollect. Maybe because of the above mentioned weak references.


-- 
Cheers,

Herbert   



More information about the Beginners mailing list