Wednesday, June 5, 2013

Freeing up memory cache for Linux OS

The Linux OS has very good RAM management system.
It free up cached memory when it needs.
But if you need to free up memory by force, you
can apply following command

sync; echo 3 > /proc/sys/vm/drop_caches

If you want to do it automatically, run a cron job to do it automatically.

create a file "clearmemory.sh" with the following content

#!/bin/sh
sync; echo 3 > /proc/sys/vm/drop_caches


Then create a cronjob like

0 * * * * /root/clearcache.sh

It will now run every hour and clear memory cache.

No comments:

Post a Comment