Session-wide valgrind

Now that we know that even Evolution runs under Valgrind, we need a bigger challenge. So, how about the entire GNOME session?

I've written a couple of tiny scripts that lower the threshold to doing this. They take care of properly launching your session in Valgrind, collecting (and filtering slightly) the resulting logs and cleaning up (important, since you can get lots of lingering valgrind processes if you don't).

I made an OpenSuSE package (for the 10.2 beta, possibly 10.1) that integrates this functionality as a pair of standard GDM sessions that you can select on login. Just click "Session" in the login screen and select one of the GNOME Valgrind ones, then log in using that. When you log out, it'll generate a log file in "$HOME/valgrind-session.$N".

The generated reports from a typical session say something about our code quality. Especially the leak report is interesting – the log file, after everything but "definite leaks" (i.e. allocated blocks to which no pointers exist, neither to the beginning nor to an internal offset) is removed, is about 2MB for a login + immediate logout here. Even though there are many repetitions and fairly harmless leaks, there are some serious-looking ones in there:

[~] grep "definitely" valgrind-session.0 | wc -l

Just install and restart GDM. At least one billion bytes of RAM recommended to run.

Not everything works in an instrumented session (su, sudo definitely don't, and I've had problems with "recent items" and logging out using the slab – remedied by adding a logout button to your panel), but overall it's not bad. You can browse the web, read mail, use Nautilus, customize your desktop, launch applications (which will themselves be instrumented) etc.

If you like proactive bug fixing (and have fairly powerful hardware), I encourage you to check it out and maybe even improve on the concept (there's a lot that could be done).

Leave a Reply

Your email address will not be published. Required fields are marked *