You may have heard the term virtual memory used in the context of your Mac, but what exactly does it do and why is it necessary? There are many mechanisms used by Mac OS X to manage the system resources of your computer, and virtual memory is just one of those techniques.
This article provides a brief overview of virtual memory, and shows how you can find out how much your Mac is using, and even what you can do to help your Mac attain the best performance possible.
So What is Virtual Memory?
Your Mac comes with a limited amount of physical memory (RAM) installed by default. Memory is critical to any computer to run applications and carry out all the operations commanded by the user. Memory must be as fast as possible (and it helps to have as much as possible) to maximise your Mac’s performance; thankfully, prices have drastically fallen in recent years. Nevertheless, every computer has a finite amount of memory so Mac OS X might actually need to use more than is physically available on your system.
This is where virtual memory comes in – you can think of it as a kind of extension to the real memory on your system, albeit much slower because it is in fact physical space on your hard disk (or SSD, if you have one installed). Let’s say that you have 4 GB of main memory on your Mac and a 512 GB hard disk. If Mac OS X needs to use all 4 GB of main memory, it can still make use of any free space on your hard disk as an extension to that memory. Unfortunately, virtual memory is much slower than the physical RAM installed in your computer, because hard disks cannot match the speed of memory chips.
Why is Virtual Memory So Important?
Virtual memory can be critical to your Mac, simply because there often isn’t enough physical memory to run all the apps that you have open. As I’m writing this article, I already have 7 apps open (Safari, iTunes, Messages, Skype, Activity Monitor, Mail, and Finder) and many processes. All those apps need a certain amount of memory allocated to run effectively – in my case, they’re using 4.43 GB of my Mac’s RAM, and the more apps that are open, the more memory will be used.
If all the memory is used up, my computer will start to use virtual memory and the whole machine will see a marked decrease in performance. Have you ever seen the spinning beach ball in Safari? That often happens when you’ve run out of memory and virtual memory is being used.
How Much Virtual Memory is My Mac Using?
There’s an easy way to find out how much memory your Mac is using and to check the virtual memory usage, as well as other information such as the number of “page outs” and “page ins”. The important term here is page ins, because it gives in an indication of how much virtual memory is being used.
To see what your Mac is up to beneath the hood, open up Activity Monitor – this is an incredibly useful native app that lives in the Applications -> Utilities folder. When it opens, go to the System Memory section to view more details about the memory usage. Click on the Real Mem column to sort the list based on the amount of memory being used.
At the bottom of the main window, there are some details about the available memory, as well as the virtual memory size, the number of page ins and page outs. In my case, you’ll see that I have 8 GB of memory installed (thanks to a recent upgrade from 4GB), and 181.37 GB of space allocated to virtual memory. This means that even if I use all 8 GB of memory, there is more space available based on the free space on my hard disk (my disk is 256 GB). Unfortunately, many applications such as Safari and iTunes seem to gobble up memory which only increases over time, so it’s always wise to check with Activity Monitor from time to time and decide whether to close a few apps or even restart your Mac.
Notice in the screenshot below that no page outs have occurred, the reason being that my memory capacity is sufficient to run all the apps I have open without needing to use any virtual memory. If I hadn’t upgraded to 8 GB of RAM however, it’s pretty obvious that my memory would already be full and the virtual memory would be in use, along with lots of page outs – there would probably be a noticeable slowdown in performance.
For more details on Activity Monitor, check out our related masterclass tutorial.
Improve Your Mac’s Performance
So how can you maximise your Mac’s performance in terms of memory, avoiding the use of virtual memory unless absolutely essential?
The simplest way by far is to increase the amount of RAM installed in your Mac. Most Mac’s these days come with around 4 GB of main memory, which is more than adequate, but if you’re a power user or frequently run dozens of apps or do some heavy work in Aperture, iMovie or Final Cut Pro, 8 GB is a decent step up for a MacBook Pro. Keeping as few apps open as necessary and regularly restarting apps that hog memory is definitely advisable. There are even apps available on the Mac App Store that will help you reclaim back memory unused by applications – check out the article here.
Physical memory prices have come down in recent years, and it’s now possible to buy two 4 GB sticks of RAM for around £30 (it’s far cheaper to buy RAM after you’ve bought your Mac from companies such as Crucial than to buy it from Apple, and installation is extremely easy). Perhaps the best way to improve your Mac’s overall performance is to buy an SSD drive. Even if your Mac does use virtual memory, an SSD is many times faster than a traditional spinning hard disk as it contains no moving parts, so the combination of extra memory and an SSD can make it feel like you have an entirely new, faster computer.
For the ultimate guides on how to speed up and troubleshoot your Mac, check out some of the articles on Chris Writes such as How to install an additional SSD drive in your Mac, troubleshooting memory usage problems, and how to improve your Mac’s performance without new hardware.