Linux kernel use RAM not only for storing programs pages. Also Linux uses RAM to store ramdisks and cache.
When system cache is become too big, a programs' pages are moved to swap partition if swap is available. Swap is works very slowly than RAM. Therefore all system performance is decline.
When system cache is become too big and no swap partition is available programs are can be stoped.
To flush a cache use this commands:
sync; echo 1 > /proc/sys/vm/drop_caches
sync; echo 2 > /proc/sys/vm/drop_caches
sync; echo 3 > /proc/sys/vm/drop_caches
This commands can be placed in script which is called by task scheduler.
In production environments it is recommended to use "Clear PageCache only" command.