Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a linux server that keeps using up all it's memory and I can't see what is using it, running top igves the following response:

Tasks: 103 total,   1 running, 102 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   8000452k total,  6336612k used,  1663840k free,   298784k buffers
Swap:  2187256k total,        0k used,  2187256k free,  4850536k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                                                                                                                         
 1847 mwl       20   0 1604m 688m  10m S    0  8.8   1:18.02 java                                                                                                                                                                            
  767 mysql     20   0  301m 101m 7424 S    0  1.3   0:33.11 mysqld                                                                                                                                                                          
  970 www-data  20   0  216m  28m 3548 S    0  0.4   0:00.33 apache2                                                                                                                                                                         
  817 root      20   0 2216m  25m 8556 S    0  0.3   0:00.29 java                                                                                                                                                                            
  944 root      20   0  196m  10m 5320 S    0  0.1   0:00.07 apache2                                                                                                                                                                         
  969 www-data  20   0  196m 6888 1452 S    0  0.1   0:00.01 apache2                                                                                                                                                                         
 1681 www-data  20   0  196m 6884 1432 S    0  0.1   0:00.00 apache2                                                                                                                                                                         
  968 www-data  20   0  196m 6872 1432 S    0  0.1   0:00.00 apache2                                                                                                                                                                         
 1696 www-data  20   0  196m 6868 1432 S    0  0.1   0:00.00 apache2                                                                                                                                                                         
 1682 www-data  20   0  196m 6656 1332 S    0  0.1   0:00.00 apache2                                                                                                                                                                         
  971 www-data  20   0  196m 6636 1360 S    0  0.1   0:00.00 apache2                                                                                                                                                                         
 1703 www-data  20   0  196m 6488 1232 S    0  0.1   0:00.00 apache2                                                                                                                                                                         
 1683 www-data  20   0  196m 6132  896 S    0  0.1   0:00.00 apache2                                                                                                                                                                         
 1702 www-data  20   0  196m 5964  744 S    0  0.1   0:00.00 apache2                                                                                                                                                                         
 1014 root      20   0  117m 3576 2304 S    0  0.0   0:00.00 console-kit-dae                                                                                                                                                                 
 2049 root      20   0 81164 3520 2736 S    0  0.0   0:00.02 sshd                                                                                                                                                                            
 1010 root      20   0 81164 3504 2724 S    0  0.0   0:00.01 sshd                                                                                                                                                                            
  706 syslog    20   0  187m 2388 1100 S    0  0.0   0:00.03 rsyslogd                                                                                                                                                                        
 2073 root      20   0 19564 2344 1624 S    0  0.0   0:00.03 bash                                                                                                                                                                            
 2065 bob       20   0 19564 2316 1600 S    0  0.0   0:00.00 bash                                                                                                                                                                            
  924 root      20   0 37196 2284 1784 S    0  0.0   0:00.01 master                                                                                                                                                                          
 1741 mwl       20   0 19452 2256 1640 S    0  0.0   0:00.00 bash                                                                                                                                                                            
  937 postfix   20   0 39420 2228 1752 S    0  0.0   0:00.00 qmgr                                                                                                                                                                            
 1092 mwl       20   0 19432 2228 1636 S    0  0.0   0:00.01 bash                                                                                                                                                                            
  936 postfix   20   0 39260 2180 1720 S    0  0.0   0:00.01 pickup                                                                                                                                                                          
    1 root      20   0 23692 1828 1240 S    0  0.0   0:01.05 init                                                                                                                                                                            
 1091 mwl       20   0 81164 1696  856 S    0  0.0   0:00.01 sshd                                                                                                                                                                            
 2064 bob       20   0 81164 1660  856 S    0  0.0   0:00.00 sshd                                                                                                                                                                            
  739 avahi     20   0 34052 1620 1300 S    0  0.0   0:00.01 avahi-daemon                                                                                                                                                                    
 2100 root      20   0 19220 1400 1064 R    0  0.0   0:00.10 top                                                                                                                                                                             
  713 root      20   0 49256 1112  564 S    0  0.0   0:00.00 sshd                                                                                                                                                                            
  801 root      20   0 21072 1016  780 S    0  0.0   0:00.00 cron                                                                                                                                                                            
  341 root      20   0 17032  984  604 S    0  0.0   0:00.05 upstart-udev-br                                                                                                                                                                 
  477 root      18  -2 17344  984  204 S    0  0.0   0:00.00 udevd                                                                                                                                                                           
  478 root      18  -2 17344  984  204 S    0  0.0   0:00.00 udevd                                                                                                                                                                           
  728 messageb  20   0 23420  912  608 S    0  0.0   0:00.01 dbus-daemon                                                                                                                                                                     
  343 root      16  -4 17048  908  320 S    0  0.0   0:00.04 udevd                                                                                                                                                                           
 1861 mwl       20   0  9752  868  704 S    0  0.0   0:00.00 tail                                                                                                                                                                            
  745 root      20   0  6076  652  544 S    0  0.0   0:00.00 getty                                                                                                                                                                           
  749 root      20   0  6076  652  544 S    0  0.0   0:00.00 getty                                                                                                                                                                           
  756 root      20   0  6076  652  544 S    0  0.0   0:00.00 getty                                                                                                                                                                           
  967 root      20   0  6076  652  544 S    0  0.0   0:00.00 getty                                                                                                                                                                           
  746 root      20   0  6076  648  544 S    0  0.0   0:00.00 getty                                                                                                                                                                           
  750 root      20   0  6076  648  544 S    0  0.0   0:00.00 getty     

As you can see over 6GB of memory is being used but the processes (which are order by memory usage) only add up to about 10%.

share|improve this question

migrated from stackoverflow.com Nov 16 '11 at 12:07

This question came from our site for professional and enthusiast programmers.

    
Disk cache? Corroborated by swap used = 0. –  Didier Trosset Nov 16 '11 at 11:56
add comment

2 Answers

up vote 5 down vote accepted

The memory usage as reported by top and free is divided into:

  • The "free" memory that isn't by the kernel at all.
  • "cached" memory, that is contents of files that the kernel remembered for fast access.
  • "buffers" memory, AFAIK cached filesystem metadata

The kernel can give memory that was used for "buffers" and "cached" to applications as well, so in a slightly incorrect way you can say that really_free = free + cached + buffers.

See also: Help! Linux ate all my RAM!

share|improve this answer
add comment

This memory is summarized as 4850536k cached: Files that were cached in memory.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.