Very often I used to find that my Linux box(s), Fedora & Ubuntu both started reserving more RAM over a period of time since its boot. And the actual RAM left free was less.
I knew it was holding some caches for itself so that it could find the programs loading “quickly” and something like that (Sorry for my newbie language).
The most common way to free up RAM is Rebooting! But I wanted to avoid it, so did a little “googling” and I came up with an interesting solution – Tell linux to flush all the caches.
# Flush file system buffers by executing sync; # free page cache echo 1 > /proc/sys/vm/drop_caches; # free dentries and inodes echo 2 > /proc/sys/vm/drop_caches # free page cache, dentries and inodes echo 3 > /proc/sys/vm/drop_caches
I’ve created a simple bash script, which u can download.