Squeak SmalltalkJoker Squeak Smalltalk : Image VM OS Application : prevnext Cleanup Image Code Snippet

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.
Michael
------------------
 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.
 ].