Skip to main content

Seaside Community Service (Picking Up Garbage)

(OK, this post is more for my reference than to teach anything, but hopefully at least I'll learn something!)

Pharo, Squeak, and most Smalltalks have the ability to save everything you are working on when you exit the environment. This saves all of the objects you have created, any text you've written, and if your program is running, it will still be running when you restart the environment, exactly where you left off.

In Smalltalk, we call it saving the image.

Images are cool, but you really shouldn't depend on them for source code control. You should back up your program code using a separate source code control system. Examples include CVS, Subversion, and Git. Some Smalltalks can use those tools and there are certainly bridges for others, but most Smalltalkers use a version control tool written especially for Smalltalk.

In Pharo, I use Monticello. Monticello integrates nicely with the existing tools. In fact, most of the time, I don't even think that I'm using Monticello at all. I just code and when it comes time to save my code, I switch to the Monticello Browser window, click Save and type in a comment. I then save my image.

Still, it takes a bit of time to load a new image from scratch. I try to do it once a month. I know a good agile process would let me do it every day or at any moment, but I'm not there yet with my Pharo work.

Even though I'm only running a personal web server and my load is light, I'm pumping a fair bit of data from a back-end data store. I cache a lot in memory to keep my query time light. Over a few weeks of running, my image will start to grow. Today I noticed I was over 100MB! That seemed like a bit much. I'm in the 30-40MB when I load from source on top of a full set of development and web serving tools.

I went searching for a quick cleanup script and I turned up a message from Bill Schwab where he had found a Seaside FAQ with some workspace code:

WARegistry clearAllHandlers.
Smalltalk garbageCollect.

That knocked 30MB off my image.

Adrian Lienhard noted that to go further, he might want to look at SpaceTally.

SpaceTally new systemWideSpaceTally inspect.

I was about to spend some time inspecting the tally, but I noticed as soon as I ran that, another 50MB flew off. I was back under 60MB, which is my pain point.

Comments

Popular posts from this blog

Installing Dart and CoffeeScript

Giving a talk on Monday, June 18 on  CoffeeScript and Dart  that will mostly be a code-along. For CoffeeScript, make sure you can run coffee from a command line: node, download here:  http://nodejs.org/ npm, now included in node CoffeeScript, use the CoffeeScript with Node and npm instructions (basically one line, but...) Some kind of programmer's text editor. I'll be using jEdit, but I'd recommend VIM or TextMate as they both have great CoffeeScript integration. For Dart, install the Dart editor, which is an IDE with a browser (Dartium). Dart editor, download here:  http://www.dartlang.org/docs/editor/getting-started/ Unpack the archive someplace and run the program from there.

Apple Hater Converted? I want an iPad!

I've tweeted several times about my misgivings on the Apple iPad. Still not getting an iPad (I'm a h8r), but Gruber's got a point against my main beef (the closed platform) http://bit.ly/a0vO6j Apr 02 2010 No scripting/coding on the iPhone was pad enough. But the iPad could have been great 4 kids to learn 2 code. Too bad. http://bit.ly/ayKHYM Jan 31st if I had an iPad rather than a real computer as a kid, I’d never be a programmer today -- Alex Payne http://al3x.net/2010/01/28/ipad.html Jan 29th I'd prefer an open platform. I think the changes to section 3.2.2 of the developer agreement are a small step in the right direction, and  I'd like to see more openness. From Boy Genius : Apple has again tweaked section 3.2.2 of the agreement, adding in a loophole which will allow them to approve certain interpretive code tools. The old section 3.2.2 read like this:  No interpreted code may be downloaded or used in an Application except for code that is interpreted a

Pride and Shame: A simple code review format for developing developers

Gave this talk at BarCamp Omaha this September. Thanks to TechOmaha for recording!