Clearing Memory Cache with Linux

Linux is usually pretty good at efficient memory management notably with freeing up cached memory.  At times when an application(s) is abusing your system, Linux may decide that cached memory is needed when in fact it’s not.  This in turn can and will eventually rob your server of free memory.  A way to combat this is to run this simple command:

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

If you need to do this on a scheduled basis, you can turn the above line into a script, and create a cron job for it.  It’s a bad sign if  apps or system functions are hogging up free memory when it doesn’t need it, so it’d be better to investigate and troubleshoot that aspect of your system, rather than blindly clearing the memory cache of a system.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s