Google Summer of Code 2010 – Week One Report
Friday, May 28th, 2010This week has been slightly heavier on schoolwork than usual (it is very close to the end of the quarter at Central Washington University). So most of my week has been spent working on tcmalloc and trying to figure out why the heap profiler is broken on Mac OS X. You can see the progress on the tcmalloc issue here. There’s a few embarrassing goofs on my part in there, but oh well.
As for Unladen Swallow, I’ve been looking at it in Instruments.
The above screenshot is of two runs of the ‘nbody’ test, which is from the Unladen Swallow test tree. The first run, top, is CPython 2.6.5 (I built my own because I didn’t want any Apple-specific code to interfere). The second run, right beneath it, is Unladen Swallow. ‘nbody’ was the test that had the highest memory usage increase when comparing Unladen Swallow to CPython. Interestingly, this memory usage appears to mostly just be a spike.
I suspect what happened in the above is that Unladen determined that the particular function it was running was considered “hot”, and then proceeded to JIT compile it. The reason it spikes is that compilation is taking quite a bit of memory, but after the end result is obtained, that memory isn’t needed anymore. There’re lots of possibilities for why there’s so much memory usage during that JIT compile. When I look at the objects which are created and still living between the time points I highlighted above, it looks like the overall memory usage increase is from 3.38MB to 5.71MB, an increase of only 2.33MB, which is acceptable. But between those two points, there is a grand total of 78.74MB allocated and freed. At its peak, the memory usage hits 13.71MB. This is where I need to focus my work. Why is it allocating so much for this particular test, considering other tests don’t cause such a large spike? How can I cut this down?
Observant readers familiar with Instruments will notice there’s a memory leak displayed in the screenshot above. This is a memory leak in LLVM 2.7, which has apparently been fixed between release and now, so it’s not particularly relevant.
I’m excited for when school is finally out. I’ll be able to really get going on this project!


