How do you know which process is using the most memory?
When I check free
in one of Prod server it showing 70% of memory is being used:
total used free shared buffers cached
Mem: 164923172 141171860 23751312 0 4555616 20648048
-/+ buffers/cache: 115968196 48954976
Swap: 8388600 0 8388600
But I didn’t find what process is using the memory, I tried the top
command and it is showing process using memory only 1.1 and 5.4 %
Is there a way to find out which process is using the memory?
Below are the results of a top command
15085 couchbas 25 0 2784m 2.4g 40m S 183.7 1.5 299597:00 beam.smp
28248 tibco 18 0 124m 100m 3440 S 20.9 0.1 2721:45 tibemsd
15334 couchbas 15 0 9114m 8.6g 3288 S 9.0 5.4 12996:28 memcached
15335 couchbas 18 0 6024 600 468 S 2.0 0.0 1704:54 sigar_port
15319 couchbas 15 0 775m 2516 944 S 0.7 0.0 269:13.41 i386-linux-godu
12167 tibco 16 0 11284 1464 784 R 0.3 0.0 0:00.04 top
12701 root 15 0 451m 427m 2140 S 0.3 0.3 18:25.02 controller
13163 root 11 -5 0 0 0 S 0.3 0.0 289:58.58 vxglm_thread
Best Answer
This will show you the top 10 processes using the most memory
ps aux --sort=-%mem | head
Using top
: when you open top
, pressing m will sort processes based on memory usage.
In linux everything is a file or process The files you opened will also eat your memory This won't help anybody
lsof
will give you all opened files with the size of the file or the file offset in bytes.