MassifG is an application for visualizing the output of valgrinds massif tool. I am writing it as part of my trainee program here at Openismus. MassifG is free software, available under GPLv3. You will find the git repository at gitorious, and the tarball release for 0.1 here. Packages for Arch are available in AUR.
Used together with massif MassifG gives you a nice, simple graph of allocated heap memory over time which you can use to help evaluate if your program is leaking memory or not:
Current status
With release 0.1 MassifG can:
- Parse and display a simple graph from massif output.
- Open files selected on the command line or from the UI.
- Print out the graph to a printer or file. This code was contributed by Murray Cumming – thanks!
I was hoping that I could make version 0.1 the “minimally useful” release, but I have to admit that it is not quite there yet. Instead I nickname release 0.1 “getting it out there”. The main issue is that there is massif output that breaks the graph, see under tests/ for an example.
Implementation
MassifG is written in C, and uses GTK+ for its graphical user interface. Once the ability to export the graph is implemented, it should be easy to allow the application to build and run without GTK, if anyone wants to do that.
The parser is a simple state-machine. It might have been wiser to use bison+flex, and I’ll reevaluate that when I need to implement parsing of the detailed output.
The graph functionality is implemented using Cairo and Pango. While Cairo and Pango are excellent technologies with nice APIs, they are quite low-level and that means having to care about all the details. As that brings no benefit to this application I might rewrite the graphing functionality to use the goffice library instead. Sadly there seems to be little high-level or introductionary documentation to goffice APIs, so I might have to fix that along the way.
Roadmap
In the short term I will:
- Implement parsing and graphing of the detailed massif output
- Fix the graphing bug(s)
- Add the ability to export/save a graph as PNG,PDF et.c. without having to go by the printing dialog
In the longer term I’m considering:
- Adding the ability to run massif on a program directly from MassifG
- An interactive mode which updates the graph while the program to be analyzed is still running
- Making a custom widget which other applications can embed
In the meantime, please do give the current version some testing, and report bugs and other issues.