Joachim Breitner

A copying garbage collector animated

Published 2012-09-03 in sections English, Haskell.

Next weekend I will hold an advanced Haskell talk at the Meta Rhein-Main ChaosDays in Darmstadt. It will mostly be a guided tour through the main memory of a running Haskell program, showing how things are represented and how they change over time. For this I cannot avoid to touch the issue of garbage collection, so I created a short animation:

(If you do not see it above, then you can try on YouTube.)

It is created with Synfig, feel free to use the sources. It seems that Synfig, although it has some features that allow you to link position in various objects, or calculate with them, is not really meant for programmers. Take the arrows: They are all quite similar, and defined by starting point, end point, and how much the initial segment sticks out to the right. I could even create them so that when I move the first or last point, the rest adjusts automatically. So one would expect that I can combine these shapes in one re-usable object that has these three values as parameters, but unfortunately, that is not the case. I guess next time I want to animate something as structured as this, I use either tikz (and generate one page per frame, convert them to an image and then to a video) or a Haskell library like gloss or diagrams.

Update: I made some minor improvements to the video. Youtube does not allow me to change the video, so you’ll see the new version only here.

Comments

I think diagrams would work quite well for this (though of course I am biased). In particular it has nice tools (using the active package, http://hackage.haskell.org/package/active) for composing animations in both space and time without having to worry about a global clock -- with gloss you simply give a function from time to a picture, but it's not compositional at all. The only thing somewhat lacking is diagrams' current support for drawing arrows, but that will improve soon.



If I get a chance I might even try replicating your animation using diagrams, it would certainly make for a nice example!
#1 Brent Yorgey (Homepage) am 2012-09-03
If you do it before Saturday and I like the result and you allow me to, I would be happy to use it in my talk.
#2 Joachim Breitner (Homepage) am 2012-09-03
I'd love to use something like TikZ for video, since it works so well for static diagrams. However, making a smoothly-animated video would require some kind of auxiliary mechanism for interpolation, to avoid hand-writing a pile of intermediate frames. Something like Beamer's incremental changes, but with a way to say "change this parameter smoothly from A to B".
#3 Anonymous am 2012-09-03

Have something to say? You can post a comment by sending an e-Mail to me at <mail@joachim-breitner.de>, and I will include it here.