This is usefull for ImageNet training when it loads a ton of images which are kept in page memory until training starts to lag.
Assume we are on Ubuntu.
First, create a cron job from root:
sudo crontab -e
And add this lines:
*/15 * * * * date >> /root/cronlog.txt && sync && /sbin/sysctl -w vm.drop_caches=3
Yes, keeping the empty line in the end. This will clear pages every 15 minutes.
THANK YOU!!!!!! I have been struggling with this for about an year!