Finding and Trimming Linux Bloat
Analyzing Linux Memory

Akkana Peck
Thursday, August 13, 2009 11:55:17 AM
I ate way too much pizza tonight. I know I'll be sorry tomorrow
morning when I step on the scale. That darn scale tells me right
off if I'm getting bloated.
It should be just as easy with programs, right? If you're running on
a low-memory system -- and these days, anything with less than two
gigabytes qualifies as low-memory -- it would be handy to know
which programs have been spending a little too much at the pizza and
ice cream joints and not enough time at the gym.
Unfortunately, memory on Linux isn't as easy as that single number
the bathroom scale gives you. So let's take a look and see what
information is available.
gmemusage
The tool that's closest to your bathroom scale is gmemusage
(Figure 1).

figure 1
It's a really nifty tool that
gives you an overview of where all the memory is
going on your system.
It's generally not installed by default, but most major Linux distros
offer it as a package. Unfortunately, Ubuntu Jaunty user have a
complication: there's a package you can install, but it doesn't work.
Check out Ubuntu
bug 370735 for various fixes.
gmemusage shows you your memory graphically, so you can see at a
glance where the hogs are. The colors are a bit garish and sometimes
hard to read, but if you use the program a lot you can configure it
with your choice of colors and fonts (see the man page).
While gmemusage is great for getting a quick overview of memory,
you shouldn't put too much faith in the absolute numbers reported
there, because there are a lot of different ways to look at memory
use on a Linux machine.
Next: Resident and Virtual Memory »