1

This issue is not the same as the question on how to see the memory usage of a Linux process.

Also, the top command doesn't give the exact memory used, but just what percentage one process uses, so is there any powerful tool which I can use to monitor memory usage of each process on Linux easily?

1
  • 1
    Virtual memory? Physical memory? Resident set? It would help a lot to know what you're actually trying to do so that we could tell you the best way to do it. Sep 5, 2012 at 3:34

4 Answers 4

3

Ummmm, how about top?

The VIRT, RES, and SHR columns (which are present by default in every version of top I've used) list memory consumed (in kb), which is exactly what you're looking for.

2

I use htop.

htop image

Extra characters.....

1

If you don't like top for whatever reason, you can also monitor the memory usage of running process (and just about anything else) with Cacti, which would give you a nice visual output, too.

In fact, someone over at the Cacti forums wrote up a script for this very thing... the memory usage of your running processes on one graph. It's for Windows, but this is pretty easy (easier, even) to do in Linux with Cacti, too.

1

Short answer is no.

Areas of memory assigned for a process may be read-only, copy-on-write or writeable. Only in the case of writeable (non-shared) memory is it assigned directly to the process. Read-only and COW pages cannot easily be counted only once where it has multiple references (since each process sees the physical pages at different addresses).

ps_mem.py does a better job than ps / top et al - but it's still a long way from being an accurate measure of what's really going on with memory - particularly on a machine raunning lots of servers.

Not the answer you're looking for? Browse other questions tagged .