On 7 January 2014 17:32, Colin Putney colin@wiresong.com wrote:
On Tue, Jan 7, 2014 at 11:40 AM, Chris Muller asqueaker@gmail.com wrote:
Don't forget there is no requirement to shrink an image along package boundaries. Did you try, for example, removing TestCase and all subclasses? That would cut across package boundaries but so what?
I left TestCase in place, but I did try removing all subclasses. That led to an emergency evaluator. :-)
It turns out I was mistaken. "Smalltalk unloadReloadablePackages" wasn't actually working, it bailed after the first few packages because it calls #fixObsoleteReferences after unloading a package, which raises an error if there are obsolete classes.
Now that I've got that sorted out, I can reliably shrink to a 11.3MB image using the attached script.
There's one oddity in that script. I had to patch SystemNavigation>>allObjectsDo:, because I was getting a #shouldNotImplement error from the SmallInteger implementation of #nextObject. Somehow, scanning the heap got to the end without encountering the sentinel object created at the top of #allObjectsDo:, and #nextObject answered 0. I'm not sure what to make of that.
Anyway, the script suggests a few fixes that should go into trunk before release.
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?
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?
frank
Colin