Subscribe to
Posts
Comments
NSLog(); Header Image

Safari’s Memory Usage

Currently, with four browser windows open (with 1 tab, 1 tab, 2 tabs, and 12 tabs in each), Safari is taking up 727 MB REAL, 1.23 GB VIRTUAL. Earlier today, I shit you not, with about 50% more windows/tabs (a total of about 24 total pages loaded), Safari was at 2.77 GB VIRTUAL and over 1.6 GB REAL. Yeah. Ouch.

Here's to hoping Safari's performance (both CPU and RAM usage) improves dramatically in Leopard, but despite blogging on performance issues, the WebKit team hasn't posted much on improvements in memory usage.

Update: As a quick read of the comments shows, many improvements have been made to Safari's memory usage. Good.

16 Responses to "Safari’s Memory Usage"

  1. I fail to see why you are drawing conclusions about memory usage from a post about background CPU usage. That seems a bit specious to me.

  2. The nightlies do actually have much better caching, so this shouldn't be as much of a problem.

  3. [quote comment="39703"]Something tells me you might be wrong. But, I see your point.[/quote]

    I doubt the iPhone will do tabbed, multi-window browsing.

    [quote comment="39704"]I fail to see why you are drawing conclusions about memory usage from a post about background CPU usage. That seems a bit specious to me.[/quote]

    Because… it's all performance-related. I didn't say it was clear evidence not to get my hopes up - just that it supported my theory. I haven't seen a post on further optimizing Safari in a long time. Though I applaud the WebKit team's rule not to worsen performance adding support for new CSS tags (etc.), I think much can be done to improve both Safari's memory and CPU footprint.

  4. Ah I see, this is a case of blog post or it didn't happen? A lot of things go on in the WebKit project without being mentioned on the blog. I can recall three big leak fixes in the last month or so, as well as some older changes to in-memory caching which significantly improve memory footprint. As always, if you can provide specific instructions for reproducing what you consider excessive memory use, please file a bug report so that the issue can be tracked and resolved.

  5. I'll second Mark's comment. Background CPU usage and memory use have nothing to do with each other.

  6. I posted a followup comment here an hour or so ago, but it appears to have been eaten? What's up with that?

  7. Trunk webkit is much faster and uses much less ram than the released version. There have been a number of blog posts about it, although iirc not one specifically about memory usage (it'd be nice to have one just to publicize it; the cache fix a while back made a huge difference).

    Overall I really fail to see why anyone would try to guess based on blog posts when it's an open source project, with every commit logged and nightly builds available...

  8. I find that Firefox uses less memory & CPU time than Safari and it doesn't start slowing down after a few hours. I also found that Opera uses even less and is much faster, but I only lasted a day with it before I switched back to Firefox.

  9. Using Flickr, by opening all the unseen photos from my contacts for a, say, two week period I can get Flickr to use 1.1GB real/2GB virtual. But that's with a couple of hundred tabs open, all with Flickr photo pages. That many tends to make any browser soil its pants and go home crying to its mother. Safari, at least, while using all that ram keeps on trucking, and indeed seems to remain very responsive.

    Of course, I'm not trying to use (say) Aperture while doing that 🙂

  10. [quote comment="39709"]I posted a followup comment here an hour or so ago, but it appears to have been eaten? What's up with that?[/quote]

    Mark, you'll find quite a few comments get moderated around here. Of course the tubes simply could have been full or leaky as well.

  11. [quote comment="39708"]I'll second Mark's comment. Background CPU usage and memory use have nothing to do with each other.[/quote]

    I never said they did, Eric.

    [quote comment="39714"]Mark, you'll find quite a few comments get moderated around here. Of course the tubes simply could have been full or leaky as well.[/quote]

    More likely it's the combination of Bad Behavior and/or Akismet. I rarely see spam that needs moderated anymore, and Bad Behavior blocks a lot of people before they reach a point where I get to see it (though it usually gives an error message and a code, I believe).

    As to "it's open source," sure. But until that source is running on the final version of Leopard with whatever "secrets" are still being kept by the mother ship, it's still all speculation.

  12. In my own experience I've seen Safari use similar memory footprints as well. When I was on my iMac that only had a 1GB of RAM I was constantly relaunching Safari to reset it's memory back to a reasonable size.

  13. [quote comment="39718"]More likely it's the combination of Bad Behavior and/or Akismet. I rarely see spam that needs moderated anymore, and Bad Behavior blocks a lot of people before they reach a point where I get to see it (though it usually gives an error message and a code, I believe).[/quote]

    Wonderful, so instead people's completely valid comments are dropped without warning?

    The gist of my comment is that the latest development versions of WebKit are very different from the currently shipping version. The version shipping with Mac OS X is nearly two years old, and many hundreds of bugs have been fixed. In particular, I can recall three big changes in the last six weeks that will reduce memory footprint. One fixes a leak which occurs in particular cases with the removeEventListener function, a second addresses a reference cycle than can occur when futzing with object prototypes in a certain manner, and another more intelligently manages the memory used when a plugin requests resources. There is also the change in in-memory caching that several people have mentioned: WebKit was very aggressive in caching pages in memory, and could potentially cache up to sixteen pages per tab in some situations. This has been scaled back to a slightly more reasonable limit.

    [quote comment="39718"]As to "it's open source," sure. But until that source is running on the final version of Leopard with whatever "secrets" are still being kept by the mother ship, it's still all speculation.[/quote]

    It's all speculation as to the specific revision of WebKit that will make its way into Leopard, but I highly doubt that Apple is going to go back through and pull out half of the fixes that have been made over the last two years. Yes, I admit that talking about development builds of WebKit is a bit annoying given that they're not usable by the average person, but there is good evidence to suggest that whatever version of WebKit ends up in Leopard will not differ too markedly from the version of WebKit currently available via the nightly builds. As such, they are a good defence against the FUD you seem to be trying to spread.

  14. [quote comment="39725"]Wonderful, so instead people's completely valid comments are dropped without warning?[/quote]

    I'm not going to justify a blogger's need to install and use anti-spam software. In this particular case, your comment was shuffled to the spam queue because you included a number of links. I saw it there and authorized it, albeit hours after it was posted.

    [quote comment="39725"]In particular, I can recall three big changes in the last six weeks that will reduce memory footprint.[/quote]

    Good. That's all I was looking for - a statement re: the memory footprint. Contrary to your belief, I don't use my blog to spread FUD - I use it to find answers and get to the bottom of things. By posting, I've drawn you (and others) here, and anyone reading the comments becomes informed.

    Case closed: Leopard's Safari may indeed use less RAM. Thank you.

    [quote comment="39725"]WebKit was very aggressive in caching pages in memory, and could potentially cache up to sixteen pages per tab in some situations. This has been scaled back to a slightly more reasonable limit.[/quote]

    Indeed, that sounds excessive.

  15. Quick Note: I updated the original post (and URL) to more accurately reflect my thoughts and to include a pointer to the many useful comments, none of which come from me. 😀