Command free via ssh only shows how many memory used, but people always seem to forget about that. Cached memory is still techincaly *free* memory that can be used. The Linux OS just doesn’t free it, it keeps it there to help speed up other applications that may need the data there. If you still want force release those cached memory/ram, and it bothers you that its not really *freeing* the memory, you can force to free the cached/buffered memory to clear out by ssh command: echo 1 > /proc/sys/vm/drop_caches


[root @ ]# free
total       used       free     shared    buffers     cached
Mem:        248488     183244      65244          0      29136     112964
-/+ buffers/cache:      41144     207344
Swap:       262136      17940     244196
[root @ ]# echo 1 > /proc/sys/vm/drop_caches
[root @ ]# free
total       used       free     shared    buffers     cached
Mem:        248488      46896     201592          0        112       7384
-/+ buffers/cache:      39400     209088
Swap:       262136      17940     244196


Something More:

Flush file system buffers by executing,

# sync

Kernels 2.6.16.x and newer versions of kernel provide a mechanism to have the kernel drop the page cache and/or inode and dentry caches on command, which can be helpful to free up a lot of memory.

To free page cache:

# echo 1 > /proc/sys/vm/drop_caches

To free dentries and inodes:

# echo 2 > /proc/sys/vm/drop_caches

To free page cache, dentries and inodes:

echo 3 > /proc/sys/vm/drop_caches

Above commands are non-destructive and will only release unused memory. As we have used sync, so it will flush all Dirty Objects which are not free able and make it as unused memory.


Leave a Reply

Your email address will not be published. Required fields are marked *

nineteen + four =