Diminishing Free Ram

I am running DTPO on a MacBook Pro, late 2013. I have noticed that during the course of the day the free RAM slowly diminishes. I find myself opening the Clean My Mac (menu bar utility) hovering over “memory” and clicking on “free up.” This will make increase my free ram by 3-5 GB.
The problem is I suffer from both OCD and ADD and the prospect of my ram becoming critically low takes my attention away from my work.

I did read a post from Bill DeVille that explained the the issue better but being able to automate the process would be great.

Thanks in advance

Just curious but why do you actually monitor the free RAM? In the worst case (compressed) virtual memory will be used by macOS and you might notice a slowdown. A better approach might be to close not required applications & databases as soon as possible. Launching apps or databases is usually fast.

Apple has been improving memory management as Mac OS evolves, and the penalty for resorting to virtual memory is greatly reduced in a Mac that uses an SSD instead of a conventional hard drive.

But even on my MacBook Pro with 16 GB RAM and a 500 GB SSD, some of my database work can gobble free RAM rapidly. For example, I often scan and OCR into a database that contains 32 smart groups to pre-classify content to save me filing time. After scanning a lot of documents into that database, I will clear it out by opening each smart group and moving its contents to an appropriate group in another database. Even with other apps closed, free RAM can get used up and I may see a spinning ball.

At that point, I could close and relaunch DEVONthink to start over with lots of free RAM. I can avoid the necessity of doing that by using C0cktail’s memory purge utility, which is set to purge memory every 60 minutes or whenever I click the button to perform a purge.