For those of us who have a bit of development experience on Apple’s iOS platform, we’re very aware of the fact that memory management can be a bit aggressive within your applications; ivars get garbage collected before you were done using them, etc. In iOS, you simply retain the object you wish for the garbage collector to ignore and the problem is no more. Well, now it seems OS X is starting to take extra notes from iOS, but so far, the only fix is to buy more RAM.
I’ve recently noticed a bunch of entries in /var/log/system.log that look something like:
com.apple.launchd: (com.apple.quicklook.satellite.3A77325E-9B47-4A09-9976-BEF4CA9953E7) Exited: Killed: 9 kernel: memorystatus_thread: idle exiting pid 45308 [QuickLookSatelli] com.apple.launchd: (com.apple.iCloudHelper) Exited: Killed: 9 kernel: memorystatus_thread: idle exiting pid 45278 [com.apple.iCloud] com.apple.launchd: (com.apple.xpcd.1B1B0000-0000-0000-0000-000000000000) Exited: Killed: 9 kernel: memorystatus_thread: idle exiting pid 45272 [xpcd]
What’s going on here?
If you follow the log you can see that launchd is forcing a process to die (Killed: 9) and then the kernel is freeing up the memory that was in use by that process. Basically, OS X has noticed that you’re running low on free memory so it’s trying really hard to free up as much as it can before it has to resort to using the much slower swapfile. Need proof? Open Activity Monitor and Console, both from /Applications/Utilities/. In Activity Monitor, switch to the System Memory tab and take note of the green “Free:” value. Now open up as many apps as needed to bring that value as close to zero as possible. Xcode, Chrome and Safari seem to help nicely in this effort. As you do this, keep an eye on Console. In my testing, you’ll start to see variations on the above log entries after your free memory dips down below ~30MB.
Is there a solution?
Technically this isn’t really a problem. It’s just OS X letting us know what it’s doing as it tries to keep things running smoothly. However, if your system is using most of its RAM on a regular basis, it can certainly clutter your logs to an alarming degree. The obvious “solution” would be to buy more RAM. If you know of another, please consider sharing via comments.