a detailed description of Context’s object memory visualization tools

direct graphical mapping of the object memory

When I got the current Context snapshot down to about 450 kilobytes, I realized that I could render it as a reasonably-sized picture (within 800 by 600 pixels). I was interested in doing this mostly because I’d never seen a graphical representation of the Smalltalk object memory before. As I proceeded, I found it enabled some pretty useful things.

simulator movies

In Squeak, I made an 8-bit-per-pixel bitmap, put the snapshot bytes into it linearly, and displayed it. It looked like a very peculiar sort of confetti… It wasn’t hard to see a few vague patterns, though. I instrumented the Squeak virtual machine simulator so that it would stop every so often to render a picture. I also chose the color of each pixel based on the class of the object of the corresponding byte.

I ran the simulator through the first 3000 instructions a Context object memory goes through after resuming, stopping after every 50 instructions to render a picture. (The simulated Context system went through its startup routine of reconnecting over the network to a headful system, so that one may browse it via remote messaging.) I put the pictures together into a 30-frames-per-second movie, a new picture every four frames. So here’s an example of extreme slow-motion; in the course of two seconds one sees roughly the first eight microseconds of execution time (as measured on my hardware).

exploring the space

But why just look at the pictures? I changed the normal picture viewer event handler so that when you click on a pixel, a cached simulator tells you more about the object of which the corresponding byte is a part. Coupled with an on-screen magnifying glass, this has turned out to be a valuable tool for finding more objects to delete from the Context snapshot.

Finally, I augmented the simulator to export graphs of all the reference relationships between all the objects in the system. Rummaging around in them in 3D is a lot of fun.

Please feel free to explore the graph data yourself and let me know if you find anything interesting. :) There are 8,628 objects (labelled) and 28,449 connections. It’s in a format for use with the Walrus graph visualizer (a lovely thing!).

I think this stuff gives new meaning to the old jargon phrase “smalltalk image”. :)

Advertisements

2 Responses to “a detailed description of Context’s object memory visualization tools”

  1. […] the smallest object memory so far a detailed description of Spoon’s object memory visualization tools […]

  2. […] I’ve made so far is 1,337 bytes long, on 19 January 2006. You can get the bits (also see my notes about the visualization tools). It adds 3 and 4, then […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: