Ubuntu Linux: Process swap memory and memory usage

Posted by David Halter on Server Fault See other posts from Server Fault or by David Halter
Published on 2012-03-22T14:01:13Z Indexed on 2012/03/22 17:34 UTC
Read the original article Hit count: 216

Filed under:
|
|
|

My Ubuntu eats more memory than the task manager is showing:

sudo ps -e --format rss  | awk 'BEGIN{c=0} {c+=$1} END{print c/1024}'
1043.84

free -m
             total       used       free     shared    buffers     cached
Mem:          3860       1878       1982          0         20        679
-/+ buffers/cache:       1178       2681
Swap:         2729       1035       1693

That's strange. Can someone explain this difference?

But what is more important: I'd like to know how much memory a process is really using. I don't want to know the virtual memory size, but rather the resident memory plus swap of a process.

I have also tried to output the format param "sz" of 'ps', but the sum of this is to high (5450 MB) (param 'size' gives 8323.45 MB). Are there any other options?

I really want to use this, to determine which programs/processes are eating to much memory (and swap), to kill them, because hibernate might not be working if the swap partition is to little.

© Server Fault or respective owner

Related posts about linux

Related posts about ubuntu