It’s time for Safari to go on a memory diet

Kirk McElhearn
12 December, 2016
View more articles fromthe author
AAA
News

Safari, help, ios, macworld australiaI like Safari. I’ve used Apple’s web browser for most of my work since it was released. I do use Chrome and Firefox for certain tasks, but Safari is my default browser.

I like the way Safari has tabs, and how you can pin tabs to keep windows available all the time while only taking up a tiny amount of space in the tab bar.

I like Safari’s Reader feature, the way it connects with my keychain to store passwords, and the ability to sync bookmarks, favourites, and other data with my iOS devices.

But there’s one thing I don’t like about Safari: it’s a gourmand.

Right now, my iMac’s uptime (the time since my last restart) is nearly four days. And Safari is using 6.81GB of RAM, by far the largest memory hog on my Mac. The app itself is using about 1GB, but each tab, each window also uses RAM. You can see this in Activity Monitor (located in /Applications/Utilities), by selecting the Memory tab.

activity monitor

As you can see above, the most egregious RAM user is Google Docs, which requires more than 500MB RAM for a single, blank document. Open a few more Google docs, and you’ll see that number quickly balloon. (It’s not clear whether this is Google’s fault or Apple’s fault.)

A lot of this memory usage depends on how long the pages or tabs have been open. If I launch Safari on my 12in MacBook, and open the exact same tabs, it only uses 2.8GB RAM. Of course, if I leave them open for a long time, that RAM usage will increase.

istat menus

You can watch this RAM grow over time. I use iStat Menus (US$18) to keep an eye on some of my Macs’ metrics, and if I check it from time to time, I’ll see that the amount of RAM used by Safari has gone up. As I write this, 15 minutes after I said above that Safari was using 6.81GB, that number has increased to 7.14GB. And it will continue increasing over time, as long as the same tabs and windows are open.

This isn’t necessarily a problem, given the way that macOS manages memory. Some memory is compressed, and some gets paged to disk (as virtual memory). Your Mac can effectively use more RAM than you have, if needed. (This Apple developer document explains how Macs use RAM; it’s not for the faint of heart, however.)

But virtual memory is not a panacea. When your Mac uses virtual memory, it writes some of the data that is ordinarily stored in RAM to your disk, in what are called ‘swap’ files. And when it wants to recover that data, it has to read these files. Reading and writing to an solid-state drive is fairly fast (though much slower than doing so to RAM), but transferring data to and from a hard disk – especially the poky 5400-rpm disks that Apple ships with iMacs – can make your Mac sluggish.

The real problem arises when users are working with RAM-hungry applications, and Safari also sucks up a lot of RAM. The latest MacBook Pro has a maximum of 16GB RAM, which may be insufficient for ‘pro’ users, but this is even more of an issue for owners of older Macs, especially those with little RAM or hard drives.

In order to improve overall performance on Macs, it would be useful to look at Safari, and find ways to limit its often excessive memory usage.

2 Comments

2 people were compelled to have their say. We encourage you to do the same..

  1. Philip Caballero says:

    Do the same problems occur with Firefox and Chrome?

    My wife is constantly complaining that that her iMac 8GB, her Retina MackBook Pro 8GB, and since last week even her new 13″ MacBook Pro 16GB, are all slowing down to a crawl with her memory usuage at about 90% most of the time. She uses Firefox most of the time and Chrome occasionally. The only other apps that are usually open are Dreamweaver and Mail.

    However, she believes that every website has the right to exist in her tabs and keeps multiples of them open!

  2. Macworld Australia Staff says:

    There’s a limit to how much you can have open at any one time on your computer. Have you taken a look in Activity Monitor to see what is hogging your wife’s computer’s memory?

Leave a Comment

Please keep your comments friendly on the topic.

Contact us