Question: How do I find out how memory is used by a particular process in Linux?
Answer: On a Linux server, a nifty little command called “pmap” will do just what you want. The command string that you will need to enter as root is:
# pmap -d PID
But first you will need to know what the PID is. To find the PID for a particular process, run the “ps” command as explained in a previous post. Once you have the process ID, you are now ready to find out more about it. For this example, let’s suppose the PID is 22938. You would enter:
# pmap -d 22938
What you get in a complete memory usage output of every library, command, and file used by that process. For example, 22938 on my computer happened to be Firefox. On a server, it would obviously be something server-related. If Firefox is hogging memory or causing problems, I can pinpoint the exact source of the memory consumption.
Source: nixCraft