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. Jonathan LaCour said on February 27, 2007:

    Something tells me you might be wrong. But, I see your point.

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

    Mark Rowe said on February 27, 2007:

    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.

    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. Mark Rowe said on February 27, 2007:

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

    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. Eric Albert said on February 27, 2007:

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

    I never said they did, Eric.

    TheSpecialOne said on February 28, 2007:

    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.

    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. Erik J. Barzeski said on February 28, 2007:

    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).

    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.

    Erik J. Barzeski said on February 28, 2007:

    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.

    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. Mark Rowe said on February 28, 2007:

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

    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.

    Mark Rowe said on February 28, 2007:

    In particular, I can recall three big changes in the last six weeks that will reduce memory footprint.

    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.

    Mark Rowe said on February 28, 2007:

    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.

    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. ๐Ÿ˜€


Trackback URI | Comments RSS

Leave a Reply

Please abide by the comment policy. Valid HTML includes: <blockquote><p>, <em>, <strong>, <ul>, <ol>, and <a href>. Please use the "Quote Me" functionality to quote comments.