[QUESTION]Morph allSubInstances size =>19196 !!

Bob Arning arning at charm.net
Tue Jun 27 21:12:02 UTC 2000


On Tue, 27 Jun 2000 22:19:57 +0200 Karl Ramberg <karl.ramberg at chello.se> wrote:
>On my daily use image I evaluated
>
>Morph allSubInstances size
>
>and got 25000 about after a _long_ time.
>Then I did the same test in a clean 2.9a image and got 3600 about.
>Then I backed up my daily use image and deleted all projects
>and got the result 19196.
>My questions are: 
>
>1 why are there so may instances of Morph still around when there are no projects etc.
>
>2 how do I kill them off if they just lay around out of use etc.

Karl,

The short answer is that there are still some references to these morphs and for them to be garbage collected you need to kill those references. One of the common places that references can be held is in class variables. Check DependentsFields first and see if anything looks out of place there. You can also use Stephan's handy PointerFinder to track some of these down. The first step would be to identify a class of morph that appears more numerous in the image than you would expect. One way to do this would be

	Smalltalk spaceTally explore

and then look through the list for something suspicious. You could make the list more manageable by running

	(self select: [ :x | x last > 0 and: [x first inheritsFrom: Morph]]) 
			asSortedCollection: [ :a :b | a third >= b third]

on the results. Once you identify a likely class, use

	TheLikelyClass allInstancesDo: [:e | PointerFinder on: e]

to see who is holding the references. Picking a class with relatively few instances will help here. Once you find the cause, kill the reference. Often the ultimate holder will have some sort of #release or #initialize method to clean up such situations. Or you may simply nil things out with an inspector. After you kill one, many others may die by themselves, so do Smalltalk garbageCollect and see if the numbers change.

You might want to take a moment first to understand why those references are still there. It could be that something you are using in your image is not properly cleaning up after itself.

Cheers,
Bob





More information about the Squeak-dev mailing list