Login  Register

Re: Minimal pharo

Posted by Mariano Martinez Peck on Jan 04, 2011; 9:42pm
URL: https://forum.world.st/Minimal-pharo-tp3174018p3174453.html

Hi Annick. I don't know which image they told you, but if you take a PharoCore 1.1.1 from here:

http://www.pharo-project.org/pharo-download/stable-core

And you evaluate:

ScriptLoader new cleanUpForRelease.

And then save and quite, the image is 6.8 MB.

Another hack I sometimes do is o put all all classes with the default category. You can still can browse and recompile the whole image.
Most production enviroments don't care about categories...they make sense when developing. (not everybody agree).
But anyway, if you then evaluate:

Smalltalk allClassesAndTraitsDo: [:each | each zapOrganization ].
Symbol compactSymbolTable.
Smalltalk garbageCollect


Then the resulted image is 6.1 mb  ;)

If you then evaluate:



"Compact all MethodDictionary instances"

| oldInstances newInstances |
oldInstances := MethodDictionary allInstances.
newInstances := oldInstances collect:
                    [ :md |   
                        (MethodDictionary new: md size)
                            compactCopyFrom: md;
                            yourself].
                       
oldInstances elementsForwardIdentityTo: newInstances.

"Different cleanUps"

TextStyle
        allSubInstancesDo: [:ts | ts
                newFontArray: (ts fontArray
                        copyFrom: 1
                        to: (2 min: ts fontArray size))].

"Clean all Monticello related stuff. You won't be able to browse packages for example"

MCWorkingCopyBrowser allInstancesDo: [:each | each flushAllCaches ].
MCWorkingCopy allInstancesDo:[:wc| SystemChangeNotifier uniqueInstance noMoreNotificationsFor: wc. wc unregister].
SystemChangeNotifier uniqueInstance noMoreNotificationsFor: MCPackageManager.
SystemChangeNotifier uniqueInstance noMoreNotificationsFor: MCWorkingCopy.

"Most application don't need sound"

SoundService default: nil.
SoundService unregister: DummySoundSystem.

SystemChangeNotifier uniqueInstance noMoreNotificationsFor: (Smalltalk at: #RecentMessageSet).

TranscriptStream newTranscript: ThreadSafeTranscript new.

ImageSegment classPool at: #RecentlyRenamedClasses put: Dictionary new.
ExternalSettings classPool at: #RegisteredClients put: Set new.

Locale classPool at: #LocaleChangeListeners put: nil.

"Clean all the changes"

ChangeSet resetCurrentToNewUnnamedChange
Set.
ChangeSet current initialize.
    ChangeSet classPool
        at: #AllChangeSets
        put: (OrderedCollection with: ChangeSet current).

Symbol rehash.

3 timesRepeat: [ Smalltalk garbageCollect. Symbol compactSymbolTable ].



You will have a 5.9 MB image :) 
is that enought?   If not, you can start unloading packages. Esteban did a lot of work with this of IPhone images.
You can ask him.

ps: I wonder if any of those scripts should be added to ScriptLoader


Cheers

Mariano


On Tue, Jan 4, 2011 at 6:48 PM, Annick Fron <[hidden email]> wrote:
Hi all,

I have now tried the minimal images indicated by Torsten and Stephane, on Windows it amounts to 9.1 Mega in memory ...
Would it be smaller on Linux ?
Yet, I still need a shoe horn, having only 8 M ram from which 1.5 is already taken by the kernel...
Any idea to downsize even more ?
Best regards

Annick Fron