Zram/ram auto clearing options & advice needed

question if know

which is the correct formatted command to auto-clears page cache, dentries, and inodes

every 30min which is what i need for my laptop’s ram to not be all chewed up during daily use

0 30 * * * sudo sync; echo 3 > /proc/sys/vm/drop_caches


*/30 * * * * /usr/bin/sync; echo 3 > /proc/sys/vm/drop_caches

my current crontab -e setting is at midnight like this

0 0 * * * sudo sync; echo 3 > /proc/sys/vm/drop_caches

but that’s to long between flushes , as the ram caching of available an free starts to become inefficient after 12hrs

id preferably like to set the flush for every 6hrs , but the only two examples i found were for 30min

for either time-frame whats the correct format ?

What is your rational for doing this? Dropping caches is completely unnecessary for the vast majority of workloads.

The file system cache is a cache of recently read files from disk so that if they’re accessed again in a short period of time, they’re read from memory instead of from disk again. If you have an application that needs the memory that’s currently held by the FS cache, the kernel will drop the oldest objects in it to allocate to the application(s) requesting it.