google heap profile

Is anybody using the google heap profiler to analyze clang/llvm ??

If so, do you know how to modify the build scripts to enable that.



I have tried to use this in the past without terribly much success. Instead, I usually use Valgrind to analyze the allocation patterns:

I’ve been using valgrind too. It seems to work fine.

I need to independently validate some numbers though because the answer has big implications for some planning we are doing.


In the past I have use the Google perf tools by using LDPRELOAD to inject them into the running binary.

Note that the subprocess-ing can impact things, you need to drop down to the cc1 invocation first.

Still, I have found that the heap profiling in these tools is strictly inferior to massif. I’d trust it. There are lots of flags you can give to massif to cause it to be very very accurate despite being quite slow. Do those help?

You can also look at the ‘-print-stats’ option (or something like that) which prints out internal allocation stats for various significant parts of Clang, and might be able to correlate the two to gain confidence.

dtrace can also be a useful tool for validating or investigating some
of the numbers.

- Daniel