[Morphic][GC] How to remove/collect garbage in Morphic?

Bob Arning arning at charm.net
Sat May 6 14:10:02 UTC 2000


On Sat, 06 May 2000 14:07:53 +0200 Stephan Rudlof <sr at evolgo.de> wrote:
>Is there an easy to use method to find root objects of a set of objects?

In theory it's real easy - you just do the mark phase of garbage collection and as soon as you hit one of objects in question, the path you followed to get there is one chain of objects keeping it from being collected. I did this once in Smalltalk (in another Smalltalk) and I usually worked but not real fast. I wonder if ImageSegments might be of help here. Hmm...

>Isn't it true, that Squeak has no problems collecting garbage of objects
>with cyclic references?

AFAIK, It's true - no problems.

>What could these root guys are, which hold morphs not #deleted
>correctly?

Some places to check:

DependentsFields - if you happen to make something dependent on a morph you need to release it explicitly or it will be referenced forever. Using a Weak dictionary would help here.

HandMorph - check the hand(s) belonging to the world, particularly the <argument> variable. This can easily get set and not get cleared.

The trash can - check the value of "Preferences preserveTrash" to see if morphs deleted via the halo are kept in the trash.

>Isn't it true, that it is OK to just delete the parent Morph of some
>submorphs and let GC do the rest?

It's absolutely OK as far as taking the morph out of the world - i.e. making it visually disappear and stop responding to events, etc. It may not be enough for garbage collection if there are other references such as the above-mentioned or if you have put references in other places that #delete doesn't know about.

Cheers,
Bob





More information about the Squeak-dev mailing list