Image/instance cleanup for 3.6gamma (was Re: [GOODIE] fixObsolete-mir)

Doug Way dway at riskmetrics.com
Tue Aug 26 17:08:31 UTC 2003


Michael Rueger wrote:

> Doug Way wrote:
>
>> Any suggestions to add to this list?  Code snippets to do actual 
>> cleanups would be very helpful, too.
>
>
> Below some more code snippets from my cleanup code, some of that not 
> suitable for the developer image though.


Thanks, Michael!  This is the sort of stuff I was looking for.  (And 
thanks to others who responded.)

- Doug


> ------------------
>
>     Undeclared removeUnreferencedKeys.
>     StandardScriptingSystem initialize.
>     ScriptingSystem deletePrivateGraphics.
>     Preferences initialize.
>     (Object classPool at: #DependentsFields) size > 1
>         ifTrue: [self error:'Still have dependents'].
>     Undeclared isEmpty
>         ifFalse: [self error:'Please clean out Undeclared'].
>
>     "Dump all projects"
>     Project allSubInstancesDo:[:prj|
>         prj == Project current
>             ifFalse:[Project deletingProject: prj]].
>     Browser initialize.
>     ChangeSorter removeChangeSetsNamedSuchThat:
>         [:cs| cs name ~= Smalltalk changes name].
>     Smalltalk changes clear.
>     Smalltalk changes name: 'Unnamed1'.
>     Smalltalk garbageCollect.
>     "Reinitialize DataStream;
>         it may hold on to some zapped entitities"
>     DataStream initialize.
>     "Remove existing player references"
>     References keys do:[:k| References removeKey: k].
>
>     Smalltalk garbageCollect.
>     ScheduledControllers _ nil.
>     Behavior flushObsoleteSubclasses.
>     Smalltalk garbageCollect; garbageCollect.
>     Smalltalk obsoleteBehaviors isEmpty
>         ifFalse:[self error:'Still have obsolete behaviors'].
>
>     "Reinitialize DataStream;
>     it may hold on to some zapped entitities"
>     DataStream initialize.
>     Smalltalk fixObsoleteReferences.
>     Smalltalk abandonTempNames.
>     Smalltalk zapAllOtherProjects.
>     Smalltalk forgetDoIts.
>     Smalltalk flushClassNameCache.
>     3 timesRepeat: [
>         Smalltalk garbageCollect.
>         Symbol compactSymbolTable.
>     ].
>
>




More information about the Squeak-dev mailing list