Statistical allocation profiler for SBCL

Posted on 2006-05-14 in Lisp

I recently had some trouble figuring out where exactly a program was consing, so I wrote a quick hack for converting the SBCL statistical CPU profiler to an allocation profiler (patch against Instead of getting profiler ticks from the system itimer, the allocator will trigger a tick every time it opens a new allocation region (basically whenever 8kB have been allocated). To use SB-SPROF in allocation profiling mode, just pass :ALLOC T to WITH-PROFILING / START-PROFILING. Other than that, all SB-SPROF functionality should work normally (disassembler integration, call graphs, slime-sprof, etc).

For example the following slime-sprof screenshot (click on thumbnail for a larger image) shows that around 7% of the consing during a profiling run was in SB-C:MAKE-TN or functions called from it, 0.91% was in APPEND when called from SB-KERNEL:VALUES-TYPE-TYPES, etc.

The patch isn't really committable as such. Since the functionality is not needed very often, I probably won't bother cleaning it up. But it might still be useful to someone even in this crude state, hence this post.

Next Cusp, a Lisp plugin for Eclipse (2006-10-14)
Previous ECLM 2006 report (2006-05-03)


By Alex on 2006-05-14

Not useful? This is incredibly useful!

By 101 on 2006-05-14

yep, one more "this is cool and useful" here! :)

By quasi on 2006-05-16

yup. very useful.

By Dave Roberts on 2006-05-16

Yup, this is amazingly useful. One of the biggest "problems" with Lisp is that it's so high level that it's difficult to figure out where a bunch of consing is coming from, slowing your program down. This would allow you to pinpoint it easily. I'd definitely clean this up and work it into the mainline build as something permanent. Juho, you rock! ;-)

By Richard on 2006-05-17

Coolest. Thing. Ever. Nice one, Juho!


As an antispam measure, you need to write a super-secret password below. Today's password is "xyzzy" (without the quotes).


Formatting guidelines for comments: No tags, two newlines can be used for separating paragraphs, http://... is automatically turned into a link.