I am checking my ram usage using free -lh command and it shows me below results.
total used free shared buffers cached
Mem: 62G 29G 33G 278M 335M 19G
Low: 62G 29G 33G
High: 0B 0B 0B
-/+ buffers/cache: 9.1G 53G
Swap: 15G 0B 15G
As i can see the used ram is 29GB and available ram is 33GB but when i check the same using top
command it shows me below output.
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
23555 glassfi+ 20 0 19.896g 5.270g 55092 S 0.0 8.4 121:16.24 java
2457 hg+ 20 0 20.294g 981344 20588 S 0.0 1.5 6:00.18 java
2615 hg+ 20 0 20.294g 950520 20560 S 0.0 1.4 0:22.18 java
1992 tomcat6 20 0 5783768 518860 20976 S 0.0 0.8 8:05.15 java
.................................................
From the above result i can see glassfish is using 19GB RAM and hg+ is using 20GB Ram, it means more than 39 GB RAM is used.
My question is then why free -lh command is showing only 29GB RAM is used
-/+ buffers/cache
line: the remaining 20GiB is used by the cache and buffers. – Stephen Kitt Oct 05 '17 at 17:21