links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
Recipe: How to get rid of objects that refer to obsolete classes
Last updated at 5:35 pm UTC on 16 January 2006


If you're trying to publish a Project, you can't do so if an object in the project refers to an obsolete class.


To fix this, you have to locate what's hanging on to the reference.
There are two ways that an obsolete class can be referred to: one is as the class of an object that didn't get garbage collected; the other is an explicit reference from inside an object.

One strategy is this:

First, try to remember what might have been referring to it. You'll
need to remove that reference. If you can't remember anything (like
if you referred to it in a script, or if you have it in a global, or
in a workspace or something), then:

First, empty your trash can. Either manually, or do this:

Utilities emptyScrapsBook

Close any Workspace or debugger windows.

Then, empty the undo: turn off the Preference infiniteUndo if it's on.
Alternatively, you can do this to clean it up:

CommandHistory resetAllHistory

Now try to save your project again. If it succeeds, fine. If not:

When the Project saving pops up a debug requester, click the "Debug" button.
Once you are in the debugger, you should be able to find a reference
to your obsolete class.
Choose various stack frames until you see a frame where self is an object of your obsolete class.
If you don't see an object of your obsolete class, then you should examine the stack frames for objects with other references to the obsolete class.

You have to find out what's hanging on to this object and not letting
it be garbage collected. There is a reference to it somewhere.

Open an inspector on your obsolete object and close the debugger.

Now do this:
Smalltalk garbageCollect

Now select "self" in your inspector and open the context menu. Choose
"chase pointers". This will show you the path from Smalltalk (the
system dictionary) down to your object.

If it's blank, select "self" and choose "objects pointing to this
value". You'll have to chase these pointers manually until you find
what's hanging on to your object and then kill it.


I like these so much that I add them to my Personal Menu in every image:
	aMenu addLine.
	aMenu add: 'SpaceTally [', (FileDirectory default fullPathFor: 'STSpace.text'), ']' translated target: SpaceTally new action: #printSpaceAnalysis.
	aMenu add: 'Empty Trash Can' translated target: Utilities action: #emptyScrapsBook.
	aMenu add: 'Clear Command History' target: CommandHistory action: #resetAllHistory.
	aMenu add: 'Collect Garbage' target: Smalltalk action: #garbageCollect.


See Also