How to remove an obsolate class

Ned Konz ned at bike-nomad.com
Fri Jul 19 00:41:14 UTC 2002


On Thursday 18 July 2002 03:58 pm, Joseph Frippiat wrote:
> When I try to save my project, a debug window opens with the
> message "Error: Trying to write out, AnObsoleteTank".
>
> How can I remove the obsolete class and save my project ?

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, ou can do this to clean it up:

	CommandHistory resetAllHistory

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

Once you are in the debugger, you should be able to find a reference 
to your ObsoleteTank. Hit the "Debug" button and choose various stack 
frames until you see a frame where self is your ObsoleteTank.

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 tank 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.

-- 
Ned Konz
http://bike-nomad.com
GPG key ID: BEEA7EFE




More information about the Squeak-dev mailing list