InstanceBrowser anyone ?

Bob Arning arning at charm.net
Sun Nov 26 21:27:45 UTC 2000


On Sun, 26 Nov 2000 20:45:31 +0100 Karl Ramberg <karl.ramberg at chello.se> wrote:
>> - Debugging instances - I guess you mean here the answer to "Why is this thing still hanging around?". There is a tool for getting this info: "PointerFinder on: FreeCell someInstance" tells me why a FreeCell instance is in my image.
>This I can too, but don't really understand. I have a hard time
>understanding the 
>hiearchy and what the different things meen.

Karl,

If you want to get a better picture of why these are hanging around, file-in the attached method and the evaluate 'SystemWindow reportReasonForAllInstances'. This may take a while, but it will produce a report that should answer the question. Send me a copy and I'll explain the kinds of things that are causing the problem.

Cheers,
Bob

=====code follows=====
'From Squeak2.9alpha of 17 July 2000 [latest update: #3044] on 26 November 2000 at 4:21:54 pm'!
"Change Set:		windowChaser
Date:			26 November 2000
Author:			Bob Arning

Evaluate

	SystemWindow reportReasonForAllInstances

of 

	AnyMorphicClass reportReasonForAllInstances

"!


!Morph class methodsFor: 'misc' stamp: 'RAA 11/26/2000 16:18'!
reportReasonForAllInstances

	| byWorld key equals pointers strm |

	(equals _ String new: 60) atAllPut: $=.
	byWorld _ Dictionary new.
	self allInstances do: [ :each |
		key _ each world ifNil: [''] ifNotNil: [each world printString].
		(byWorld at: key ifAbsentPut: [OrderedCollection new]) add: each
	].
	strm _ WriteStream on: (String new: 5000).
	strm 
		nextPutAll: equals; cr;
		nextPutAll: 'instances not in any world'; cr;
		nextPutAll: equals; cr; cr.
	byWorld at: '' ifPresent: [ :collection |

	'Researching world-less morphs'
		displayProgressAt: Sensor cursorPoint
		from: 0 to: collection size
		during: [:bar |
			collection withIndexDo: [ :inst : index |
				bar value: index.
				strm nextPutAll: index printString,'. ',inst externalName; cr.
				pointers _ PointerFinder new goal: inst; search; pointerList.
				pointers do: [ :ptr |
					strm tab; nextPutAll: ptr printString; cr.
				].
			].
		].
	].
	strm cr.
	byWorld keysDo: [ :k |
		k = '' ifFalse: [
			strm 
				nextPutAll: equals; cr;
				nextPutAll: 'instances in world ',k; cr;
				nextPutAll: equals; cr; cr.
			(byWorld at: k) withIndexDo: [ :inst :index |
				strm nextPutAll: index printString,'. ',inst externalName; cr.
			].
			strm cr.
		].
	].
	StringHolder new
		contents: strm contents;
		openLabel: 'all instances of ',self printString! !





More information about the Squeak-dev mailing list