[squeak-dev] About unloading of packages in the most recent Squeak 4.1 trunk

Edgar J. De Cleene edgardec2005 at gmail.com
Sat Aug 21 12:21:42 UTC 2010


Here the thing i made for 3.10, Andreas improve and i use for
SeasideLight3.0 , with this you rip 3 mb from ready to run image (Seaside
3.0)

Edgar

-------------- next part --------------
'From Squeak4.1 of 17 April 2010 [latest update: #9957] on 25 July 2010 at 8:25:32 am'!

!SmalltalkImage methodsFor: 'shrinking' stamp: 'edc 7/25/2010 08:25'!
unloadAllKnownPackages
	"Unload all packages we know how to unload and reload"
	" SmalltalkImage current unloadAllKnownPackages"

	"Prepare unloading"
	Smalltalk zapMVCprojects.
	Flaps disableGlobalFlaps: false.
	StandardScriptingSystem removeUnreferencedPlayers.
	Project removeAllButCurrent.
	#('Morphic-UserObjects' 'EToy-UserObjects' 'Morphic-Imported' )
		do: [:each | SystemOrganization removeSystemCategory: each].
	Smalltalk at: #ServiceRegistry ifPresent:[:aClass|
		SystemChangeNotifier uniqueInstance
			noMoreNotificationsFor: aClass.
	].
	"World removeAllMorphs."
PackageList new packages select: [:ea | ea packageName beginsWith: 'Configuration'] thenDo:[:any|  (MCPackage named:  any packageName ) unload  ] .
PackageList new packages select: [:ea | '*Tests*'  match:  ea packageName]    thenDo:[:any|  (MCPackage named:  any packageName ) unload  ] .

	"Go unloading"
	#(	'ReleaseBuilder' 'ScriptLoader'
		'311Deprecated' '39Deprecated'
		'Universes' 'SMLoader' 'SMBase' 
		'VersionNumberTests' 'VersionNumber'
		'Services-Base' 'PreferenceBrowser' 'Nebraska'
		'ToolBuilder-MVC' 
		'CollectionsTests' 'GraphicsTests' 'KernelTests'  'MorphicTests' 
		'MultilingualTests' 'NetworkTests' 'ToolsTests' 'TraitsTests'
		'SystemChangeNotification-Tests' 'FlexibleVocabularies' 
		'EToys' 'Protocols''Tests' 'SUnitGUI'
	) do:[:pkgName| (MCPackage named: pkgName) unload].
	"Traits use custom unload"
	"Smalltalk at: #Trait ifPresent:[:aClass| aClass unloadTraits]."
	"Post-unload cleanup"
	
	SystemOrganization removeSystemCategory: 'UserObjects'.
	Presenter defaultPresenterClass: nil.
	World dumpPresenter.
	ScheduledControllers := nil.
	Preferences removePreference: #allowEtoyUserCustomEvents.
	SystemOrganization removeEmptyCategories.
	ChangeSet removeChangeSetsNamedSuchThat:[:cs | (cs == ChangeSet current) not].
	Undeclared removeUnreferencedKeys.
	StandardScriptingSystem initialize.
	MCFileBasedRepository flushAllCaches.
	MCDefinition clearInstances.
	Behavior flushObsoleteSubclasses.
	ChangeSet current clear.
	ChangeSet current name: 'Unnamed1'.
	Smalltalk flushClassNameCache.
	Smalltalk at: #Browser ifPresent:[:br| br initialize].
	DebuggerMethodMap voidMapCache.
	DataStream initialize.
	Smalltalk forgetDoIts.
	AppRegistry removeObsolete.
	FileServices removeObsolete.
	Preferences removeObsolete.
	TheWorldMenu removeObsolete.
	Smalltalk garbageCollect.
	Symbol compactSymbolTable.
	TheWorldMainDockingBar updateInstances.! !


More information about the Squeak-dev mailing list