0

top reports that 99% of the memory is used. But when sorted by memory usage Shift+M I only see about 20% being used. How can I find out which process is using all my memory?

$ top

top - 21:13:30 up  1:47,  1 user,  load average: 1.03, 0.84, 0.85
Tasks:  70 total,   1 running,  69 sleeping,   0 stopped,   0 zombie
Cpu(s):  4.9%us,  0.3%sy,  0.0%ni, 94.6%id,  0.2%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   7629464k total,  7404500k used,   224964k free,    84964k buffers
Swap:        0k total,        0k used,        0k free,  5718640k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                                            
 3463 elastics  20   0 3646m 1.2g  16m S   11 16.8  25:40.03 java                                                                                                
 4146 ubuntu    20   0 27112 9692 1756 S    0  0.1   0:00.79 bash                                                                                                
  972 whoopsie  20   0  183m 4272 3052 S    0  0.1   0:00.01 whoopsie                                                                                            
 4049 root      20   0 73436 3596 2792 S    0  0.0   0:00.02 sshd                                                                                                
 1090 www-data  20   0 64104 3228  968 S    0  0.0   0:02.62 nginx                                                                                               
  664 root      20   0 50032 2900 2292 S    0  0.0   0:00.01 sshd                                                                                                
    1 root      20   0 24320 2284 1360 S    0  0.0   0:01.62 init                                                                                                
 1119 root      20   0  105m 1656 1088 S    0  0.0   0:02.86 monit                                                                                               
 4145 ubuntu    20   0 73436 1544  748 S    0  0.0   0:00.11 sshd                                                                                                
  681 syslog    20   0  247m 1536 1120 S    0  0.0   0:00.73 rsyslogd                                                                                            
  541 root      20   0 23436 1368 1020 S    0  0.0   0:00.00 vsftpd                                                                                              
 1089 root      20   0 62912 1324  220 S    0  0.0   0:00.00 nginx                                                                                               
  295 root      20   0 21528 1316  792 S    0  0.0   0:00.06 udevd                                                                                               
 4844 ubuntu    20   0 17328 1244  944 R    0  0.0   0:00.05 top                                                                                                 
 1062 Debian-e  20   0 47472 1116  664 S    0  0.0   0:00.00 exim4                                                                                               
  688 messageb  20   0 23940 1004  672 S    0  0.0   0:00.02 dbus-daemon                                                                                         
  773 root      20   0 19112  996  768 S    0  0.0   0:00.01 cron                                                                                                
  746 root      20   0 14504  968  804 S    0  0.0   0:00.00 getty                                                                                               
  761 root      20   0 14504  968  804 S    0  0.0   0:00.00 getty                                                                                               
  764 root      20   0 14504  964  804 S    0  0.0   0:00.00 getty                                                                                               
  751 root      20   0 14504  960  804 S    0  0.0   0:00.00 getty                                                                                               
  762 root      20   0 14504  960  804 S    0  0.0   0:00.00 getty                                                                                               
 1142 root      20   0 14504  960  804 S    0  0.0   0:00.00 getty                                                                                               
  350 root      20   0 21456  776  364 S    0  0.0   0:00.00 udevd                                                                                               
  351 root      20   0 21456  728  320 S    0  0.0   0:00.00 udevd                                                                                               
  774 root      20   0  4328  672  524 S    0  0.0   0:00.00 acpid                                                                                               
  285 root      20   0 17232  640  448 S    0  0.0   0:00.05 upstart-udev-br                                                                                     
  505 root      20   0  7264  604  108 S    0  0.0   0:00.00 dhclient3                                                                                           
  441 root      20   0 15188  388  196 S    0  0.0   0:00.01 upstart-socket-                                                                                     
  775 daemon    20   0 16908  384  220 S    0  0.0   0:00.00 atd                                                                                                 
    2 root      20   0     0    0    0 S    0  0.0   0:00.00 kthreadd                                                                                            
    3 root      20   0     0    0    0 S    0  0.0   0:00.13 ksoftirqd/0                                                                                         
    4 root      20   0     0    0    0 S    0  0.0   0:00.00 kworker/0:0                                                                                         
    5 root      20   0     0    0    0 S    0  0.0   0:00.02 kworker/u:0                                                                                         
    6 root      RT   0     0    0    0 S    0  0.0   0:00.00 migration/0                                                                                         
    7 root      RT   0     0    0    0 S    0  0.0   0:00.02 watchdog/0                                                                                          
    8 root      RT   0     0    0    0 S    0  0.0   0:00.00 migration/1                                                                                         
    9 root      20   0     0    0    0 S    0  0.0   0:00.00 kworker/1:0                                                                                         
   10 root      20   0     0    0    0 S    0  0.0   0:00.30 ksoftirqd/1                                                                                         
   11 root      RT   0     0    0    0 S    0  0.0   0:00.02 watchdog/1                                                                                          
   12 root       0 -20     0    0    0 S    0  0.0   0:00.00 cpuset                                                                                              
   13 root       0 -20     0    0    0 S    0  0.0   0:00.00 khelper  

Tried ps_mem.py but couldn't tell which process was the culprit:

$ sudo ./ps_mem.py

 Private  +   Shared  =  RAM used   Program
188.0 KiB +  35.5 KiB = 223.5 KiB   atd
176.0 KiB +  58.0 KiB = 234.0 KiB   acpid
208.0 KiB +  82.0 KiB = 290.0 KiB   upstart-socket-bridge
272.0 KiB +  89.0 KiB = 361.0 KiB   cron
284.0 KiB + 105.0 KiB = 389.0 KiB   upstart-udev-bridge
568.0 KiB +  15.0 KiB = 583.0 KiB   dhclient3
456.0 KiB + 173.5 KiB = 629.5 KiB   vsftpd
628.0 KiB +  45.5 KiB = 673.5 KiB   dbus-daemon
604.0 KiB +  74.5 KiB = 678.5 KiB   exim4
596.0 KiB + 197.5 KiB = 793.5 KiB   sudo
808.0 KiB + 124.5 KiB = 932.5 KiB   monit
  1.0 MiB +  92.5 KiB =   1.1 MiB   rsyslogd
832.0 KiB + 369.0 KiB =   1.2 MiB   udevd (3)
  1.1 MiB + 163.5 KiB =   1.3 MiB   init
956.0 KiB + 384.0 KiB =   1.3 MiB   getty (6)
  1.8 MiB +   1.2 MiB =   3.0 MiB   nginx (2)
  2.6 MiB + 464.5 KiB =   3.0 MiB   whoopsie
  1.2 MiB +   2.1 MiB =   3.3 MiB   sshd (3)
  9.0 MiB +  92.5 KiB =   9.1 MiB   bash
  1.3 GiB + 536.0 KiB =   1.3 GiB   java
---------------------------------
                          1.3 GiB
=================================

free reports the same:

$ free -m
             total       used       free     shared    buffers     cached
Mem:          7450       7233        216          0         87       5514
-/+ buffers/cache:       1631       5819
Swap:            0          0          0

Can someone help me debug?

Eric Carvalho
  • 54,385
Ram
  • 101

0 Answers0