|I could definitely use that 200Mb!|
Recently, I became concerned by the fact that my 4 year old MacBook Pro was spinning its fan more than usual. It also quite annoyed me that on a fresh boot most of my RAM was being used up, all before I’d even launched an app.
A quick visit to an Apple Store confirmed that the fan was functioning OK. The Genius I spoke to pointed out that I should use the Activity Monitor to see if any processes were getting out of control. I fully expected to discover that there was some application I’d installed that was the cause of the problem.
When I spent a bit of time researching, I spotted that two processes were hogging large amounts of memory, often over 600Mb. The first was the daemon for ClamXav, a defacto standard for free anti-virus software on the Mac. They have two versions. The one in the App Store is a standalone app which can scan your Mac’s hard drive for viruses. The full version available on their website is more sophisticated, and can actively watch your Mac for suspicious activity. It was the full version that was causing part of the problem, so I uninstalled it and dropped back to the cut-down App Store variant.
I can only hope Apple are aware of this bug and will address it in an upcoming version of Mavericks, but until then I’ve taken it upon myself to implement a bit of a crude solution as a stopgap.
The script I’ve written can be run as a cronjob, and it’ll kill the process when it takes up too much memory. The script also has support for Growl, so you can receive a notification when the process is killed.