Hello,
I'm working with Linux 2.4.18
I'll like to know, if there is a way to know exactly what is using the RAM memory of my box.
I try with ps command, but the size of the memory usage than I can calculate, it is very diferent compared with the information that I get with the free command.
There is an aplication, or a way to examine in detail the RAM usage??
You may have to look closer at the ps command for process by process information (realize that this still does not give you anything but a snapshot of what is going on when you run it - building a script to collect the information might help.).
Another thing to note - you run the ps command and do your calculation. That uses memory, cpu. You run the free command and that uses cpu, memory...if you are on a single cpu server, there is no way you can run both commands at exactly the same time. Other processes will finish and give back memory, some will start up and eat up more. You need to understand that you would never get A=B.
The memory resident info obtained either from ps (rss) or 'top' (RES) adds upto what is more than actual RAM.
I believe this is due to shared memory mapping of the processes.
So what is the best method to identify the actual ( can I call it as effective ) memory usage/consumption by the processes ?
The 'pmap -x pid' gives information under tabs of Kbytes / Resident / Shared and Private.
Is an arithmetic exercise on these fields give the correct information ?
( Pls look at this info
#ps -e -o pid,vsz,rss grep 21941 gives an output like,
PID VSZ RSS
21941 136168 116408
and the #pmap -x 21941 give the summary as ,
\(Kb\) \(Resident\) \(Shared\) \(Private \)
total Kb 135424 122320 16736 105584
Any clue why the memory info is different... Which one is *more* correct . ? )
Appreciate your reply. This will clear a lot of confusion on memory usage...
When you posted this question, I tried the commands on a sample process on a 2.6 machine and both commands agreed. So I just moved on since I didn't have anything useful to say.
But I just downloaded memtool and the docs say:
I found the instructions to obtain memtool here. Click on "cool tools"; then "memtool". Also on that page, click on "pmap -x", where you will find: