Thursday, July 19, 2007

Valgrind memory measuring done better

Create a memory tool similar to KCacheGrind.

Valgrind is a fantastic application with several built in tools. One of the tools is massif, a heap profiler. While nice this tool was quickly put together and leaves you wanting more. It generates two output formats. The first is a pdf file. The data is squished to fit onto the pdf size, colors are reused and in general it is just hard to read. The second format is txt/html. The txt is near worthless, but the hmtl is at least a little bit usefull. With enough time and effort you can get some good information out of it. At the end of the day massif only touches the tip of the iceberg as far as features go.

Change massif to generate a data file similar to callgrind where you get a complete stack trace every time memory is allocated or deallocated. Then a rich tool can be created that can graph the data, you can select the any allocation and get details on what it is and where it was allocated.

Another tool could be run as the data is generating showing a graph of memory usage so when you do something in your application and the graph spikes up you would immediately see it.

A tool like this is missing in open source.

No comments: