OS X Mavericks preview: Compressed Memory gives your Mac room to run

OS X Mavericks Preview: Compressed Memory gives your Mac room to run

Another example of how Apple is trying to make Mavericks more efficient is "Compressed Memory." This technique helps free up memory from dormant apps that don't need it. The net result: your Mac runs and wakes from sleep faster.

If you open a lot of applications, or if some of your apps need a lot of memory, your Mac will slow down. Way down. That's because your Mac runs out of physical RAM to allocate. OS X isn't in the habit of saying no, though, so what it does is create a swap file that gets written to your Mac's hard disk. That swap file contains the contents of inactive memory. Reading from that swap file and writing to it takes time, and that slows the Mac down.

Apple has ameliorated some of the effects of swap memory in machines like the MacBook Air, which uses flash storage instead of a conventional hard drive. The MacBook Air has pretty limited amounts of RAM compared to other Macs but can still run a number of applications simultaneously quicker than Macs with conventional hard drives, thanks to the speed of flash storage. And newer MacBook Airs can go even faster, with speedy PCIe-based storage.

Not all Macs have flash storage, however. And even solid state drives have their limits. The speed of SATA and PCIe interfaces are less than the direct path between the CPU and the installed RAM, creating a bottleneck.

Improving memory efficiency

Apple set out to do things a bit differently in OS X Mavericks, and they've come up with a memory compression scheme that does the trick. Here's how it works:

At any given time, dozens of different processes - applications, background tasks and more - may be running on your Mac. A lot of them you may have absolutely no awareness of, unless you open the Activity Monitor app in your Utilities folder - they're not items that appear in your Dock, and there's no way to interact with them directly.

Before Mavericks memory compression

These processes and the apps you're running may be sitting in memory but not actively using memory. But they're there, and they're grabbing a little piece of your Mac's available RAM. Cumulatively, they take up space and create the potential for slowdowns.

Apple has engineered Mavericks to be aware when your Mac is reaching its physical RAM limit. And when it does, Mavericks leaps into action and figures out which processes are active and which are inactive. It then compresses the memory that the inactive applications have allocated, which frees up more RAM. That keeps your Mac from having to write content out to and read from swap files.

After Mavericks memory compression

According to Apple, compressing and decompressing memory happens "almost instantly," so there's no slowdown and therefore no downside for the user. Apple says that with memory compression on Mavericks, they're seeing 1.4x speed increases in system reponsiveness under load, when opening documents or reactivating inactive applications, even on machines equipped with fast SSDs.

Your Mac has to write out swap files when it goes to sleep and it needs to read the when it wakes up. There's also a big improvement in the time it takes a Mac to wake from standby - 1.5x faster, compared to Mountain Lion.

It's yet another way that Mavericks promises to improve efficiency compared to Mountain Lion and what's come before, which means a faster and better user experience for you.

Have you seen your Mac slow way down as it manages big swap files? Do you think Mavericks will make a big difference for you? How much RAM does your Mac have? I want to hear from you, so please let me know in the comments.

Peter Cohen

Managing Editor of iMore, Mac and gaming specialist and all-around technologist. Follow him on Twitter @flargh

More Posts



← Previously

How to edit your Twitter profile with Twitter for iPhone and iPad

Next up →

Apple Developer Center returns after an eight day outage

Reader comments

OS X Mavericks preview: Compressed Memory gives your Mac room to run

Sort by Rating

Great write up Peter. I'm curious though and maybe you can consider covering this. What computers can take advantage of all the things in Mavericks? For example: With Mountain Lion, my old MacBook Pro couldn't handle AirPlay Mirroring because it was 'too old' even though the rest of Mountain Lion worked fine. Is there any gotcha's like that with Mavericks?

I was also thinking the same thing after reading all these great posts by Peter on the upcoming features in Mavericks how many of them will i be able to utilize on my old hardware ?

It's a really good question. The vast majority of the stuff I've talked about is, as far as I can tell, generic to any Mac that can run Mavericks - but I'll check and see what, if anything, is going to be model-specific.

As someone with a 2012 i7 iMac with 32 GB RAM, I am really curious to see what benefits I'll get out of Mavericks. I'll be upgrading on day 1, and I'm interested to see what differences I'll notice on what is an already snappy system.

The only major issue I've had with ML in 7 months of Mac ownership is that restarts and shutdowns have taken noticeable longer after 10.8.3 and 10.8.4 have been released, even on an SSD. If Mavericks can fix this, it's worth the upgrade to me.

The other major benefit will be iCloud Keychain.

I'll be doing a clean install.

I have a mid-2010 iMac that came with 8 gigs of RAM. I added another 8 myself - the max the iMac can handle. I run Photoshop CS6 all day long and even optimized according to Adobe's specs, it's a resource hog. If Safari is opened at the same time it brings the Mac to its knees. I use Free Memory, an inexpensive app, to release inactive RAM throughout the day. If Mavericks does a better job of RAM management, it would be a tremendous relief! Fingers crossed!

Interesting development! I presume that with compression they actually (or mostly) mean defragmentation? I'm still running 10.6 (on a mid 2011 i7 MBP 13" with 8Gb RAM), and find that my swapfiles tend to grow, apparently simply because they don't get reorganised as much as they could. And that can really slow down a machine that's otherwise still perfectly snappy, like yesterday when I'd upgraded my MacPorts installation and run a lengthy XCode session more or less in parallel.
(I have a hunch that freeing an app's memory that's been swapped to disk doesn't decrease used swap space as long as the app remains running and/or other apps use(d) the same swap file.)