How to examine the memory usage??

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??

Thanks in advace.
Regards!

Perhaps examining the size column of the output of the top command is what you are looking for?

you can also try vmstat

The linux version of vmstat only provides summary information:

   Swap
www# vmstat    
   procs                      memory    swap          io     system         cpu
 r  b  w   swpd   free   buff  cache  si  so    bi    bo   in    cs  us  sy  id
 0  0  0   1452  79228 282476  68832   0   0     0     2    2     2   1   1   1

I think the poster was looking for detailed process-by-process RAM usage information, as I understood the post.

I try it to, but the result it's the same that ps.

Yes, that is what I'm looking for.
I'm sorry if the sintax of the post looks a litle weird, my english is not very good :stuck_out_tongue:

Thanks again!|

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.).

Determine process memory usage (Note 'accepted answer')

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.

Hello All,

A few questions on same topic.

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...

Thanks in advance...

I am sorry, I missed out these information.

Operating system : Solaris 2.6
Pagesize : 8192
RAM : 512 MB

Thanks for the info.
I'm going to run a few test...

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:

So you may be right about pmap.

Hi,

Thanks a lot.. That was a great help...