7

I know this is a lame question, but I want to understand why CentOS consumes my Physical memory when certain process stopped. Suppose I have opened a file of 10GB then it consumes 10GB in ram and buffers when I finished the process and closes the file, then CentOS still holds my 10GB of ram.

When I run free command it gives me following details:

11.4 GB are used
in buffers: 6336
in cached: 49168

-/+ buffers/cache: 11.4GB used

when I try to free up my memory using following solutions:

How do you empty the buffers and cache on a Linux system?

How to clear memory cache in Linux

Setting /proc/sys/vm/drop_caches to clear cache

-/+ buffers/cache: still holds 11.4 GB.

1 Answers1

8

First of all you don't need to free up any buffers or cache yourself unless you have a specific requirement. Linux saves caches for improving the performance of memory access. Buffers are just temporary location and both cache and buffers will keep changing depending on the tasks which Linux is doing.

There is a link which describes the fields very nicely http://www.linuxnix.com/2013/05/find-ram-size-in-linuxunix.html

Updating the new link: https://www.linuxnix.com/find-ram-size-in-linuxunix/

Incase the link doesn't work in future here is little more expalantion. Below is the output of free -m

             total       used       free     shared    buffers     cached
Mem:          7753       2765       4987          0         24        570
-/+ buffers/cache:       2171       5582
Swap:         8191          0       8191

-/+ in the second line:

Total used RAM is (2765) - (24 + 570) = 2171 [ - in the second line]
Total Free RAM is (7753 - 2765) + (24 + 570 ) = 5582 [ + in the second line ]
bluefoggy
  • 662