[squeak-dev] Shrinking

Ken G. Brown kbrown at mac.com
Wed Jan 8 03:44:46 UTC 2014


John McIntosh did some shrinking work many moons ago when working on Squeak for iOS.
Perhaps this old email could help with your shrinking? Maybe there was further work after the email.

   Ken G. Brown

> Date: Wed, 11 Feb 2009 21:13:50 -0800
> From: John M McIntosh <johnmci at smalltalkconsulting.com>
> Subject: Re: [squeak-dev] ditching Monticello objects.
> To: Keith Hodges <keith_hodges at yahoo.co.uk>
> Cc: The general-purpose Squeak developers list
> 	<squeak-dev at lists.squeakfoundation.org>
> Message-ID:
> 	<B07FF75B-07C4-4C3F-ABB9-E6397B70AC73 at smalltalkconsulting.com>
> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
> 
> Ok, well I did
> 
> I've been collecting lists of pruning methods so..
> 
> 	ScrollBar initializeImagesCache.
> 	GradientFillStyle initPixelRampCache.
> 	NaturalLanguageFormTranslator classPool at: #CachedTranslations put:  
> nil.
> 	NaturalLanguageTranslator resetCaches.
> 	PartsBin clearThumbnailCache.
> 	PaintBoxMorph classPool	at: #ColorChart put: nil.
> 	PaintBoxMorph classPool at: #Prototype put: nil.
> 	ImageMorph classPool at: #DefaultForm put: (Form extent: 1 at 1 depth: 1).
> 	Utilities classPool at: #ScrapsBook put: nil.
> 	Project allInstancesDo: [ :each | each setThumbnail: nil ].
> 	ScriptingSystem stripGraphicsForExternalRelease.
> 	ProjectHistory currentHistory initialize.
> 	Utilities zapUpdateDownloader.
> 	Smalltalk forgetDoIts.
> 	Behavior flushObsoleteSubclasses.
> 	CommandHistory allInstancesDo: #initialize.
> 	ChangeSorter removeChangeSetsNamedSuchThat: [ :each | true ].
> 	ChangeSet resetCurrentToNewUnnamedChangeSet.
> 	MethodChangeRecord allInstancesDo: [ :x | x noteNewMethod: nil ].
> 	RequiredSelectors initialize.
> 	ProvidedSelectors initialize.
> 	LocalSends initialize.
> 	SendCaches initializeAllInstances.
> 	Utilities cleanseOtherworldlySteppers.
> 	Smalltalk organization removeEmptyCategories.
> 	Browser initialize.
> 	SMSqueakMap default purge.
> 	SystemBrowser removeObsolete.
> 	TheWorldMenu removeObsolete.
> 	AppRegistry removeObsolete.
> 	FileServices removeObsolete.
> 	MCFileBasedRepository flushAllCaches.
> 	MCDefinition clearInstances.
> 	Undeclared removeUnreferencedKeys.
> 	Smalltalk flushClassNameCache.
> 	3 timesRepeat: [ Smalltalk garbageCollect. Symbol compactSymbolTable ].
> 	Set rehashAllSets.
> 	Smalltalk garbageCollect.
> 
> 
> 
> I added these ones.
> 
> 	ChangeSorter initializeChangeSetCategories.
> 	MCWorkingCopy inspect.
> 	MCRepositoryGroup inspect.
> 	MCCacheRepository inspect.
> 
> and cleaned up the class instance variables & any class vars via the  
> inspect.
> 
> That removed all the MC packages and MC http repositories from the MC  
> Browser
> 
> gave me back 4 megabytes of image space.
> 
> Well brute force, still 4 mb wonderful to get back this late in the  
> project.
> 
> 
> On 11-Feb-09, at 6:18 PM, Keith Hodges wrote:
> 
> > John M McIntosh wrote:
> >> I'm building an image for a limited memory hardware platform.
> >>
> >> At the point here where I want to *deploy* things and I can see that
> >> various parts of Monticello
> >> are consuming well over a megabyte of memory to retain MCVersionInfo
> >> instances, MCMethodDefinition(s), time stamps, uuids, etc etc
> >>
> >> I'm wondering if anyone has some code to strip all that out thus
> >> returning I suspect a couple of MB back for more constructive usage?
> > You may want to look into the cleanUp/freeSomeSpace conventions. MC1.5
> > has a few implemented. There are many more available from
> > http://bugs.squeak.org/view.php?id=7244
> >
> > Keith
> 
> --
> = 
> = 
> = 
> ========================================================================
> John M. McIntosh <johnmci at smalltalkconsulting.com>
> Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
> = 
> = 
> = 
> ========================================================================
> 



On Jan 7, 2014, at 12:38 PM, Colin Putney <colin at wiresong.com> wrote:

> 
> 
> 
> On Tue, Jan 7, 2014 at 2:28 PM, Frank Shearar <frank.shearar at gmail.com> wrote:
>  
>  I notice for starters that you #zapMVCProjects _after_ unloading ST80.
> Did you move that specifically, or was that just happenstance from
> folding #unloadReloadablePackages into the shrink script?
> 
> No, I think the zapping happens while ST80 is still there. I moved the list of packages to unload to the top, but left the actual unloading in place.
>  
> Regarding this guy:
> 
>   names do: [:pkgName | (PackageInfo named: pkgName) classes do: [:ea
> | ea unload]].
>   names do: [:pkgName | Installer mc unload: pkgName].
> 
> That's pretty much what I was thinking of doing inside MC's
> #basicLoad. I hesitated because it involves sending #unload twice to
> every class, and doubted whether general implementations of #unload
> were idempotent.
> 
> But I guess it must have worked out OK for you during the script?
> 
> It seems to. But I thought the problem was that #unload has no effect, because the method has been removed by the time message is sent, and we fall back to the superclass noop. I originally had one loop the first sent #unload to all classes, than unloaded the package, but I found that was more sensitive to the order of the package names. The unload method would fail because it depended on something that's already gone. Two loops seems more robust. 
> 
> I'm still working on it—down to about 10MB now. Will post again when I declare victory.
> 
> Colin
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20140107/d1c57436/attachment.htm


More information about the Squeak-dev mailing list