My older iMac is complaining that it’s running out of application memory. How do I figure out what app is causing the problem and fix it?
Ah, yes, the dreaded “Your system has run out of application memory” error in MacOS X. It’s not a problem that comes up too often because being built on a Unix foundation, Mac OS X actually has decades of memory management evolution under the hood, but sometimes you can get a program that gets bigger and bigger in memory and causes problems. Surprisingly, though, sometimes the problem has nothing to do with the applications you’re running at all and instead is all about the disk space you have available.
Turns out that for the memory in your computer to work properly and let you gracefully multitask, you need to ensure that there’s space on disk for the operating system to temporarily write out blocks of memory so that the precious commodity of RAM (random access memory, the fast, expensive stuff) can be utilized by the current foreground task or program. Think of it this way: you can’t put calls on hold on a fancy phone system if you don’t have enough space for each incoming call. Memory works the same way, a combination of your RAM (and an older iMac might have 8GB or 16GB of RAM) and your disk space (hopefully your iMac has at least 256GB of disk space to be useful).
Let’s start with the basics, though. Here’s the kind of error message you’re probably seeing:
Never a good thing. Notice also that the system pauses commands that it can’t run because of the lack of memory, in this case the developer’s program Xcode. That’s a pain because even if you get rid of all the other applications, it’s not easy to unpause a paused program in MacOS X.
Pro tip: If you do want to unpause it once you’ve freed up resources, use the Terminal. The ps command can get you the process ID of the paused program, then use kill -CONT processID to send a continue signal to the application and bring it back to life. Make sure you include the -CONT or you’ll instead kill the app instead.
Since you’re in the Force Quit Applications window when you see this error, you can simply pick programs that are gracefully exited (like Preview, perhaps, or Mail) and click “Force Quit” to get rid of ’em.
While it’s possible that there’s a program with a so-called memory leak or other bad coding that causes it to get bigger and bigger, eventually greedily consuming all memory resources, it’s also possible that you can encounter this problem because you’ve run out of disk space!
Check your disk resources by going to “About This Mac” from the Apple menu (top left of your screen) then choosing “Storage”. The most modern versions of MacOS X give you this attractive display:
The most important thing to check is how much space you have that’s available. I have 127.22GB of 499.96GB, which is great. You’ll always want at least 10% disk space available for the OS and memory swapping tasks, but 15% is a better number if you can manage it. With a 500GB drive that means I’d need to keep 50-75GB free if possible. The less available space you have, the more you’re stressing the memory manager and disk manager and can see some performance issues.
There’s also a great program included with MacOS X that you should check to see the memory footprint of each app on your iMac too: Activity Monitor. This can be found in Applications > Utilities and is terrific for getting an idea of what’s happening with your computer in a lot of different ways. On my MacBook Pro, for example, here’s how memory usage stacks up:
I clicked on the “Memory” column title to have processes sorted by memory usage and you can see that kernel_task is using the most, followed by Kiwi for Gmail helper and CrashPlanService. Kiwi is a third party Gmail interface and it’s somewhat known for being inefficient with memory so that’s no surprise to me. Notice it needs just under 1GB of memory to run (and that there are two additional processes with the same name that want another 214MB and 174MB too). On my system, quitting Kiwi and its helper apps will free up a lot of memory needs.
Then again, as you can see in the “memory pressure” box below, I’m in good shape anyway right now, with 16GB of physical memory and only 10GB being used. You can use more memory than you have, of course, because it’ll swap out as needed, but the key value here is “Swap Used” and “Cached Files”: those should always be significantly smaller than your available disk space to keep things humming along.
Check Activity Monitor on your computer and it should help you identify which program is consuming all your memory. Then replace it with a different program that is written to be more memory aware. I should also note that some programs get bigger over many days, so quitting and restarting can ease the problem instantly in those cases (indeed, that’s what “memory leak” refers to: A program that gradually gets bigger because it’s “leaking” memory).
While you’re looking at Activity Monitor, check out the other tabs along the top too. They offer some good insight into CPU usage, which programs are using your network connection aggressively, and so on.
Hope this helps you figure out what’s going on with your iMac!