com.apple.IconServicesAgent

 

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.

That left me with one remaining problem, which was a process called com.apple.IconServicesAgent. It would continue to grow in size after my Mac had booted, and never gave up any of its memory. Worse still, if you logged in as another user, it would spawn another instance which didn’t even get killed off when logging out.
A search of Google makes it clear that lots of other people are suffering from the same problem. The process seems to do what it says on the tin, which is build up a cache of icons as you browse the Finder so that on subsequent visits to directories the icons are presumably supposed to display quicker (spoiler: they don’t). I can’t imagine why such a process would need to hang on to 600Mb of RAM, over 1/7 of my available memory.
A partial solution presented here helped control the problem somewhat by bringing down the maximum amount of memory the process would use, but I could still see it creep up to 300Mb on occasions. Apps like DropBox and Google Drive which frequently scan directories in the background tend to cause com.apple.IconServicesAgent to eat more memory.

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.

It’s a crude solution, because I don’t know with 100% certainly what the process does. I do know that with only 4Gb of RAM, each megabyte is precious to me.
You can find the script here on GitHub. Please let me know in the comments if you try it out, or if you’ve a better approach to handling this kind of problem.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Powered by WordPress.com.

Up ↑

%d bloggers like this: