7

I've just upgraded to Yosemite and started using the new Safari 8.0. For a while, everything seemed fine, but then all got ever so slightly slower and slower, especially when switching desktops.

After losing patience, I opened Activity Monitor and to my shock, I found around a dozen old Safari Web Content processes still running and using a lot of memory, despite the tabs having been closed already.

Anyone noticed a similar thing? Or knows a way to force Safari to kill the process after closing a tab?

(Macbook Pro, mid-2012, 13inch, 4GB RAM)

  • Does this behaviour happen every time ? – Matthieu Riegler Oct 20 '14 at 9:46
  • Yes - whenever I close tabs, the processes stay running in the background. – metjush Oct 20 '14 at 10:06
  • I meant each time after you restart Safari ! – Matthieu Riegler Oct 20 '14 at 10:11
  • I quit Safari, checked that all processess were gone and restarted it. It doesn't happen anymore. – metjush Oct 20 '14 at 11:16
  • 1
    So not a permanent bug probably, but a bug nonetheless. – metjush Oct 20 '14 at 11:17
2

I've seen this ever since Safari 8 on OS X 10.9.5, OS X 10.10.x all versions with Safari 8 and sadly in Safari 9 on all El Capitan betas to date, too. The Safari memory leak in my case is severe and Safari has to be completely quit & restarted often. It only seems to happen if you tend to have a few windows open a lot, which you "reuse"; but overall, Safari just grows and grows (by many GB).

Suggestions about "putting in more memory" are absurd. I've a 16GB Macbook Pro laptop which is the maximum configuration of soldered-on ("pro" my rear-end!) memory which Apple provide. It simply isn't possible to add more. Memory pressure and slowdown tend to get critical when Safari exceeds 10GB. I did once persist to the point where it was using over 13GB. When restarted with all tabs manually revisited to ensure all pages are loaded, it'll go back to about 2.5Gb. A leak of that size is utterly indefensible.

This is a stark change in behaviour from Safari 7, which behaved basically fine in this regard - yet there are surprisingly few reports of it online. It isn't a subtle problem and Safari 8 has been around for ages. Others would have noticed, yet few report it.

I see it on my 10.9.5 machine, 10.10 home laptop, 10.11 test laptop and even, more recently, a 10.10 laptop at work. My conclusion is that this must be Safari screwing up when particular bookmark, cookie, cache and/or other data is present and this data must be part of the stuff it shares over iCloud - otherwise I would not have expected my independently clean-installed-by-IT-vendor work laptop to exhibit exactly the same behaviour.

Bottom line is that this seems to be a user data thing. Taking a deep breath and doing a complete Safari reset - ditching your iCloud bookmarks, emptying everything from every Safari instance on the iCloud account, deleting ~/Library/Safari and so-on - might work according to the Developer Forums. But as ever with Apple since roughly OS X 10.7, its a heisenbuggy mess and no amount of psuedorandom chicken slaying will be guaranteed to fix your issue.

Closed tab stray processes might just be down to a "bad extension", but that's no excuse - extensions are under Safari control, and a bad extension should never be able to break the browser. It's just JavaScript code executing completely under the browser's oversight. Still, we know that Safari must have very poor code for extension support given the problematic history, so that's always worth investigating if you haven't already.

1

"Web Content Process" = "Tab" is a wrong assumption. A Web Content process can hold more than one tab. Depending on the implementation details of Safari, it might be possible that after closing the last Tab related to a particular Web Content Process, it does not automatically mean to close that Web Content Process. It might be feasible for Safari to keep that Process idle in the background ready to take a new tab when needed. I think Mavericks Safari behaves the same.

On your experience of "slower and slower": It might be that 4GB of RAM are insufficient for your normal workload. As a result, virtual memory is used. That means your HDD (or SSD) is used as an extension for your RAM, when more memory is needed to drive all open processes. Usage of HDD means a slowdown. An SSD is better in that respect.

I use Safari 7 on Mavericks, I will not test now what happens when closing a big enough number of tabs. But let me describe the normal situation on my MBP: At the moment, my Safari has 4 windows open, each contains 10 to 40 tabs, in sum ~100 tabs opened. In Activity Monitor, I can see 20 Web Content Processes, each 9 to 12 threads. In addition, I have 13 QTKitserver Web Content Processes, each 2 threads. All web content processes have a 3-digit PID, which means they were started at the beginning after my last reboot, which is 3 days ago. So the Web Content Processes are reused by Safari. If they were new processes, they would have gotten a 4 or 5 digit PID. Though, I admit I did not open and close that many tabs since the last reboot. I have 8GB of RAM and an SSD on a late 2009 MBP.

You can read at some places that Yosemite needs a little more RAM than Mavericks. Maybe that's enough to slow down your 4GB system in comparison to Mavericks. Though it should not perform much worse than Mavericks. By the way, a nice read on memory management for 10.9 can be found here.

Bottom line: Consider installing 8GB RAM. It's dirt cheap for a non-Retina MBP.

And you can do it yourself. Just figure out before which RAM-Modules are for your MBP Model: https://support.apple.com/kb/HT201165?viewlocale=en_US#1.

It seems that even 16GB are possible for even older MBPs if one is lucky. Beware, this 16GB topic needs more research: https://forums.macrumors.com/showthread.php?t=1511196

But I do not know if that is needed in your case. In my humble opinion, 8GB are fine.

  • The Mavericks version of Safari did to my knowledge not behave the same way. In my opinion this is a bug. It makes no sense that Safari would keep 10 "Web Content Processes" running with each taking up to 100Mb of memory in RAM. These processes should be cleaned when relevant tabs are closed. – Adriaan Tijsseling Oct 21 '14 at 7:31
  • The RAM usage should shrink when closing tabs. It is possible that a cleanup does not happen immediately. But after a while the Web Content Processes show smaller numbers for mem usage. Thread counts must not shrink, it is a common programming pattern to keep threads open in a thread pool. But I start speculating, I am still on Mavericks, and will be for a while :). The point I wanted to make, to look only at those numbers in Activity Monitor does not mean everything, cause the operating system has sophisticated methods to handle memory usage. – Anon Oct 21 '14 at 9:19
  • “These processes should be cleaned when relevant tabs are closed.” Well, if you close a tab and then hit ⌘Z, it will reopen the tab. That’s probably another reason why the Web Process is not immediately killed when you close the tab. – Zearin Mar 9 '15 at 21:05
  • See my reply. Safari 7 doesn't exhibit the problem and suggesting someone adds memory when they report an obvious memory leak is doubtless well intentioned, but ultimately really not too helpful. – Andrew Hodgkinson Aug 12 '15 at 21:46

You must log in to answer this question.

protected by Community Oct 23 '14 at 12:05

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged .