Clear Memory Cache on Linux Server

We can manually free up the memory cache with the following simple command:

//Find exact memory utilization by issuing following command:

[root@demoServer ~]# free -m
total used free shared buffers cached
Mem: 7827 7566 261 0 97 6585
-/+ buffers/cache: 883 6944
Swap: 4999 12 4987


//Issue following command to free up cache memory:

[root@demoServer ~]# sync; echo 3 > /proc/sys/vm/drop_caches


//Issue following command to find exact memory utilization after clearing cache:

[root@demoServer ~]# free -m
total used free shared buffers cached
Mem: 7827 2767 5060 0 1 1993
-/+ buffers/cache: 771 7056
Swap: 4999 12 4987

You will find difference between used and cache memory before and after clearing cache.

In case of heavy memory consumption, you will set cron job to clear memory in hourly basis OR as per your convenience.

Note: Please don’t hesitate to revert in case of any query OR feedback.

Thanking you.

Have a easy life ahead.

This entry was posted in Linux and tagged .

2 thoughts on “Clear Memory Cache on Linux Server

  1. Hi we have database around 25TB in which there is table that has a only table that the operator access which around 1TB so whenever they access it asks for free buffers where we have 64 GB RAM so if clear cache at OS level will it give better performance……please reply ASAP

    • There is no direct relation between database performance and clear cache at OS level.
      You need to increase RAM and assign maximum of it to oracle in order to fulfill operator request & increase database performance.

      Show me result of following:
      #free -g //From root user
      #free -m //From root user

      SQL> Show parameter SGA_TARGET // From sys user.
      SQL> Show parameter MEMORY_TARGET // From sys user.
      SQL> Show parameter sga_max_size // From sys user.

Leave a Reply to Ramakrishna Y Cancel reply

%d bloggers like this: