I have a shell script which calls around 20 python scripts each reading atleast couple of files of size 500MB each. After a couple of python scripts are run, there is like 40MB out of 8GB ram. I tried the below command and it worked and left me with 5.8 GB memory free.
echo 1 > /proc/sys/vm/drop_caches
Is there a programmatic way to do this exact thing from python? Or How can I force python to free up the memory occupied by it?