1

My server has 62 GB RAM but now i can see only 716 MB RAM is free. Below is the output of free -lh command

             total       used       free     shared    buffers     cached
Mem:           62G        62G       716M       277M       415M        52G
Low:           62G        62G       716M
High:           0B         0B         0B
-/+ buffers/cache:       9.8G        53G
Swap:          15G        16M        15G

From the above output i can see that only 716 MB is free out of 62GB but when i see the process using top -o RES command as shown below(sorted in descending order of RES) only glassfish is consuming 5 GB ram and rest of the other processes are in MB's. if we add up the memory of all this processes then it will not reach to 62GB. My question is then now which processes are consuming more memory and why the top command is not showing theses processes??

top - 04:20:33 up 5 days, 15:46,  2 users,  load average: 0.00, 0.00, 0.02
Tasks: 272 total,   1 running, 271 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.1 us,  0.1 sy,  0.0 ni, 99.8 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
MiB Mem:  64431.17+total, 63715.67+used,  715.496 free,  415.574 buffers
MiB Swap: 16380.99+total,   16.984 used, 16364.01+free. 53273.82+cached Mem

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
18640 glassfish+20   0 20.284g 5.399g  59.9m S   0.0  8.6  48:56.94 java
 2750 h+        20   0 20.294g 954.7m  19.8m S   0.0  1.5   3:06.16 java
 7837 h+        20   0 20.294g 899.9m  20.0m S   0.0  1.4   0:20.89 java
 2088 tomcat6   20   0 5641.2m 493.9m  20.7m S   0.0  0.8   3:59.54 java
 2166 mirth     20   0 6572.8m 375.2m  21.7m S   0.0  0.6   7:26.73 java
 1307 oj        20   0 20.670g 308.1m  19.5m S   0.3  0.5  10:28.15 java
31903 postgres  20   0  384.2m  77.4m  76.0m S   0.0  0.1   0:00.25 postgres
 1799 rabbitmq  20   0 2167.9m  69.2m   4.0m S   0.7  0.1  47:14.13 beam.smp
 6622 postgres  20   0  386.0m  36.8m  34.0m S   0.0  0.1   0:00.50 postgres
 1668 postgres  20   0  384.2m  32.7m  31.4m S   0.0  0.1   0:19.87 postgres
 2234 h+        20   0  318.3m  23.8m   3.8m S   0.0  0.0   0:17.42 beam.smp
 7857 postgres  20   0  385.3m  15.5m  13.2m S   0.0  0.0   0:00.33 postgres
31904 postgres  20   0  384.2m  12.1m  10.7m S   0.0  0.0   0:00.49 postgres
 8089 postgres  20   0  385.2m  10.9m   8.9m S   0.0  0.0   0:00.00 postgres
 8090 postgres  20   0  385.2m  10.9m   8.9m S   0.0  0.0   0:00.00 postgres
 8091 postgres  20   0  385.2m  10.9m   8.9m S   0.0  0.0   0:00.00 postgres
 8092 postgres  20   0  385.2m  10.9m   8.9m S   0.0  0.0   0:00.00 postgres
 7919 postgres  20   0  385.2m  10.8m   8.8m S   0.0  0.0   0:00.00 postgres
 8088 postgres  20   0  385.2m  10.8m   8.8m S   0.0  0.0   0:00.00 postgres
 7920 postgres  20   0  385.2m  10.8m   8.8m S   0.0  0.0   0:00.00 postgres
 8093 postgres  20   0  385.2m  10.8m   8.8m S   0.0  0.0   0:00.00 postgres
 8094 postgres  20   0  385.2m  10.8m   8.8m S   0.0  0.0   0:00.00 postgres
  573 syslog    20   0  250.0m  10.3m   2.3m S   0.0  0.0   0:01.98 rsyslogd
31902 postgres  20   0  384.7m   8.0m   6.3m S   0.0  0.0   0:01.63 postgres
31905 postgres  20   0  384.8m   7.3m   5.6m S   0.0  0.0   0:00.23 postgres
16662 root      20   0  103.2m   6.6m   5.5m S   0.0  0.0   0:00.06 sshd
 5064 root      20   0  103.2m   6.5m   5.5m S   0.0  0.0   0:00.03 sshd
 5301 root      20   0  103.2m   6.5m   5.5m S   0.0  0.0   0:00.01 sshd
20529 root      20   0  103.2m   6.4m   5.4m S   0.0  0.0   0:00.05 sshd
16813 b+        20   0   21.9m   6.4m   3.3m S   0.0  0.0   0:00.19 bash
 5380 b+        20   0   21.0m   5.4m   3.2m S   0.0  0.0   0:00.05 bash
 1190 root      20   0   59.9m   4.8m   4.7m S   0.0  0.0   0:00.02 sshd
16812 b+        20   0  103.2m   4.7m   3.7m S   0.0  0.0   0:00.29 sshd
20618 b+        20   0  103.2m   4.7m   3.6m S   0.0  0.0   0:00.12 sshd
31906 postgres  20   0  103.5m   4.6m   2.3m S   0.0  0.0   0:00.42 postgres
 2340 ntp       20   0   30.7m   4.3m   3.7m S   0.0  0.0   0:23.77 ntpd

1 Answers1

4

Reading data from a disk is far slower than accessing data from memory. Linux caches blocks from the disk in memory. In fact, Linux uses all free RAM for the buffer cache to make reading data as efficient as possible.

To calculate real free memory you have to add free + buffers + cached from Free command.

Actual Free Memory = Free (716M) + Buffers (415M) + Cached (52G)