Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

This question already has an answer here:

Top is not showing my memory usage accurately or is my VPS provider doing something strange? As you see in the picture bellow it uses 90%+ of the memory, but when you look at what processes that is actually using memory it doesn't even sum up to over 30%. I know that top doesn't show correctly when processes have shared memory, but for example the httpd prodcesses that use shared memory barely take any percentage at all of the available memory even when summed up.

The top command in the picture is sorted after memory usage, so there is no big process hiding.

http://i.imgur.com/GGBXCN9.png (Apparently I didn't have enough reputation to post pictures is questions.)

Update with the top output as text:

Tasks:  49 total,   1 running,  48 sleeping,   0 stopped,   0 zombie
Cpu(s): 17.7%us,  1.1%sy,  0.0%ni, 81.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.3%st
Mem:   2097152k total,  1858988k used,   238164k free,        0k buffers
Swap:  2097152k total,   140740k used,  1956412k free,  1089504k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                                                                                           
  812 mysql     20   0  513m 241m 5104 S  4.7 11.8 108:32.39 mysqld                                                                                                                                            
  882 root      20   0  344m 219m 6116 S  0.0 10.7   1:08.81 clamd                                                                                                                                             
26111 root      20   0  851m  34m 9720 S  0.0  1.7   1:30.03 java                                                                                                                                              
22155 cpanelro  20   0 94272  10m 2392 S  0.0  0.5   0:00.04 cpsrvd-ssl                                                                                                                                        
22260 cpanelro  20   0 94092 9792 2272 S  0.0  0.5   0:00.02 cpsrvd-ssl                                                                                                                                        
21175 cpanelro  20   0 94092 9704 2276 S  0.0  0.5   0:00.03 cpsrvd-ssl                                                                                                                                        
 7491 root      20   0 47732 8520 2176 S  0.0  0.4   0:00.10 leechprotect                                                                                                                                      
  623 named     20   0  245m 5256 1940 S  0.3  0.3  11:58.59 named                                                                                                                                             
 1639 root      20   0 46644 5172 1408 S  0.0  0.2   1:46.64 tailwatchd                                                                                                                                        
 1472 root      20   0 93828 4972 1352 S  0.0  0.2   0:17.42 cpsrvd-ssl                                                                                                                                        
23781 root      20   0 38800 4928 2160 S  0.0  0.2   0:00.57 zsh                                                                                                                                               
17788 nobody    20   0 69072 4336 2488 S  0.0  0.2   0:00.21 httpd                                                                                                                                             
  917 root      20   0 68588 4288 3000 S  0.0  0.2   0:28.16 httpd                                                                                                                                             
21152 nobody    20   0 69124 4224 2456 S  0.0  0.2   0:00.05 httpd                                                                                                                                             
20549 nobody    20   0 68992 3716 1996 S  0.0  0.2   0:00.07 httpd                                                                                                                                             
20550 nobody    20   0 68992 3536 1792 S  0.0  0.2   0:00.06 httpd                                                                                                                                             
21996 nobody    20   0 68992 3508 1788 S  0.0  0.2   0:00.02 httpd                                                                                                                                             
20544 nobody    20   0 68992 3484 1804 S  0.0  0.2   0:00.05 httpd                                                                                                                                             
21995 nobody    20   0 68992 3432 1704 S  0.3  0.2   0:00.02 httpd                                                                                                                                             
22228 nobody    20   0 68992 3396 1704 S  0.0  0.2   0:00.00 httpd                                                                                                                                             
22226 nobody    20   0 68588 3300 1924 S  0.0  0.2   0:00.00 httpd                                                                                                                                             
21154 nobody    20   0 68720 3172 1716 S  0.0  0.2   0:00.03 httpd

Update with free -m:

free -m
             total       used       free     shared    buffers     cached
Mem:          2048       1864        183          0          0       1063
-/+ buffers/cache:        800       1247
Swap:         2048        137       1910
share|improve this question

marked as duplicate by Wesley, Falcon Momot, Ward, Jenny D, MadHatter Oct 9 '13 at 9:23

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1  
Is it Xen or VMware? –  Michael Hampton Oct 9 '13 at 2:50
    
Seems to be OpenVZ? The file /proc/user_beancounters exists anyways. Not sure how to determine, they don't say on their website. –  spydon Oct 9 '13 at 3:01
add comment

1 Answer 1

up vote 1 down vote accepted

Keep in mind that there is a distinction between 'active' and 'consumed' memory. Linux tends to store large volumes of data in memory in case it's needed in the future. But processes may not actively be using this memory - in which case they report a lower volume of 'used' memory.

Should a process suddenly demand more memory, then the kernel will release some of that cached data, and allow the process to use it.

So technically the memory is both 'used' and 'free' at the same time.

You should familiarize yourself with the 'free' command. I also like using htop instead of top, as it displays these differences.

Here is a previous question that was answered quite well. Give it a read and you should get a better understanding of how to interpret 'top' data.

share|improve this answer
    
Ah, so the cached memory is actually available for usage by the other processes? –  spydon Oct 9 '13 at 3:02
    
Pretty much yeah, I just added a similar question being asked some time ago, give that a read. There's a good explanation in there. –  blacklight Oct 9 '13 at 3:06
    
Thanks! This one seems to explain it quite well too linuxatemyram.com –  spydon Oct 9 '13 at 3:10
add comment

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