Clear RAM Memory Cache on Ubuntu Linux
Every Linux System has three options to clear cache without interrupting any processes or services.
Log in to the Ubuntu server and enter the root privileges by sudo -i
Clear PageCache only.
sync; echo 1 > /proc/sys/vm/drop_caches
Clear dentries and inodes.
sync; echo 2 > /proc/sys/vm/drop_caches
Clear PageCache, dentries, and inodes.
sync; echo 3 > /proc/sys/vm/drop_caches
https://www.tecmint.com/clear-ram-memory-cache-buffer-and-swap-space-on-linux/