re: Shrinking

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

re: Shrinking


Hi Colin--

> What's the state of the art in shrinking these days?
> I'm starting a new web project with Squeak, and I want to create a
> smallish base image that I can use to build up images for development
> and deployment. It doesn't have to be absolutely minimal, just
> unloading unnecessary code and cleaning up the registries, clearing
> caches etc would fine.
> I tried "Smalltalk shrinkAndCleanDesktop", but it complains about
> obsolete behaviours still being present, so I guess there's some bit
> rot there.
> Suggestions?

     I think the best way to shrink is for the garbage collector to do
it. There's an alternate version of the GC in Spoon[1], invoked with
Interpreter>>primitiveSnapshotWithoutStaleMethods. It sets a mark bit on
all the methods associated with contexts in extant processes, along with
any other methods which have run (for example, by running unit tests).
Then it treats all other methods as garbage in the pre-snapshot GC.

     This leads to a chain reaction; the methods that aren't marked are
usually the only things referring to their literals (including classes).
The process is immediate, and requires no knowledge of what's being
thrown away. The only difference between producing a minimal system
(currently 1kB) and a larger one (e.g., the Spoon development base
system at 300 kB) is how many methods you mark in advance by running them.



Craig Latta
+1 510 984 8117
(Skype rings this until 31 January 2014)

Craig Latta
+1 510 984 8117
(Skype rings this until 31 January 2014)

Spoon mailing list
[hidden email]