Now and again the p.g.o sees a post about working out how much memory a process, or GNOME as a whole, uses, and about the limitations of the ‘normal’ ways of querying memory usage. In fact, there is a tool which is perfect for this kind of a task: it was written by John Berthels and is called Exmap.
When it comes to analysing memory use, Exmap simply rules: it will tell you how much VM process uses, how much of that is shared (and how well shared), how much is mapped, how much is writeable. If that is not enough for you, Exmap will break down the memory use into the individual executable modules the process has loaded, with the same level of detail as it did for the entire process. Want more? Well, why not have a look how the memory is distributed between module sections? Exmap will let you. Still not happy? You can, providing the module contains the necessary symbol info, have a look at the individual symbols. Exmap simply rocks!
There is, though, a small fly in the ointment — Exmap is a GUI application. This is great if you want to have a look at a process you are running on your desktop. It is not so great if you want to save the results for later, and you are truly skunnered if you need to analyse an embedded system on which running the GUI is out of question. At OpenedHand the latter is our bread and butter, and so the idea of a command line client for exmap was born.
The current version of the command line client will let you get at most of the information the GUI application would, with a level of detail controlled by a handful of command line options. It can send the results either to stdout or a file of your choosing, either in a ‘human-friendly’ (indented) form, or in csv format (so you can load it into your favourite spreadsheet). In addition, it comes with a very simple daemon that allows you to spawn exmap periodically, and log results.
(P.S. To build it from the sourceball, you will need to have the kernel headers for the kernel with which it is to be used; once it builds, you have to load the exmap kernel module before you can run exmap. Oh, and the bugzilla is here.)