Schedule a Job to Clear Memory with Cron
Setup Locally
- Enter as root with crontab
sudo crontab -e
- Add the following cron job
0 3 * * * sync; echo 3 > /proc/sys/vm/drop_caches
- Check there is no error
sudo crontab -l
Test the command individually
If you want to test the command to verify it work on your system
echo 3 | sudo tee /proc/sys/vm/drop_caches
To check if the memory usage slow down
top
or for a more visual representation you can use bottom
# pacman -S btm
btm