
OS X Lion Bug: Safari guzzling massive amounts of RAM - shawndumas
http://www.tuaw.com/2011/07/27/os-x-lion-bug-safari-guzzling-massive-amounts-of-ram/
======
jws
The author's testing methodology appears unable to tell _leakage_ from
_caching_.

If your machine isn't swapping, then any unused memory is wasted. Better to
keep all sorts of speculatively cached data. For a web browser that includes
downloaded resources, but it could also include the rendered bitmaps of page
fragments, preparsed documents, or any manner of partial computation that may
be reused later. Once there is memory pressure the code can start dropping
these things.

~~~
hackermom
Assuming it's just cached content, Safari 5.1 is then caching _a lot_ more
than 5.0.x did.

------
jolan
> Disabling all but a handful of my Safari extensions brought the Safari Web
> Content subprocess's RAM usage down from 1.06 GB or more down to a much more
> manageable 300 - 320 MB with five tabs opened, but over time usage climbed
> to over 600 MB again, so it's possible one of my enabled extensions is the
> culprit.

Why even post this if you're not going to investigate aside from extension
disabling roulette?

------
justinph
This is somehow unique to Safari, or bad? Has the author never used chrome or
firefox? Right now I've got three tabs open in chrome and it's using 703 mb of
ram between all the threads.

A modern browser will gobble memory. But it will also get paged out to disk
when necessary, and that's not such a terrible thing.

~~~
dpark
Paging to disk is pretty terrible if it's not strictly necessary. If your
storage is an HDD, it can sometimes be faster to regenerate the paged
information rather that read it back from disk. I don't know if Safari is
actually causing memory contention here or if it's just aggressively caching
while still playing nice. But if its cache is causing a lot of paging, that
could very well be worse for performance than just reducing the cache size.

------
pohl
_...however, I was seeing huge amounts of RAM usage even with only three or
four tabs open. Four webpages shouldn't be consuming over a gigabyte of RAM._

I think it's a mistake to equate 4 tabs with 4 web pages worth of content.
Each tab actually represents a list of web pages that corresponds to that
tab's history, and each element in that list is actually the root of a tree of
resources needed for each of those pages, and if the user uses the back
button, they often do not want to merely return to the page as it would be
fetched by the request, but they also want to return to the state of the DOM
as it was when they were just there, such as the state of a form they were
entering. With the swipe-to-go-back interface, the previous page needs to be
available pretty fast to make the UI responsive to this gesture.

This smells more like a cache to me than a leak.

------
zdw
Web browsers running code and rendering arbitrary documents from who knows
where might use or leak memory? This is surprising to people?

Every web browser I've ever used eventually needed to be quit and restarted to
clear out it's memory leaks.

~~~
guylhem
I've found the situation slightly better with Opera on OSX, but even with Snow
Leopard and 4G of RAM, Safari leaked memory after 7 days

------
hackermom
It's in Safari 5.1. I'm running 10.6 still and Safari is indeed guzzling more
memory, through that process, than it did in version 5.0.x.

~~~
r00fus
Same here... on my Santa Rosa 10.6 MBP w/4GB at work, it can get quite
annoying.

At home on my later model MBP w/8GB and Lion it's not even noticeable.

