Add-ons
The main news in the past two weeks has been about Kyle Huey’s patch that prevents most chrome-to-content leaks, which are the most common kind of add-on leak. Testing showed it worked beautifully, but caused a knock-on leak in add-ons built with old versions (1.3 and earlier) of the Add-on SDK. (This received a lot of attention.) Kyle then made a slight tweak that fixed that knock-on leak. So we’re currently still on track for Firefox 15 being “the one that fixes add-on leaks”.
For completeness, here are the add-ons that we know were temporarily affected by that knock-on leak: Wallflower, Visual Hashing, Translate This!, Easy YouTube Video Downloader. They (and probably quite a few others) are all working fine again now.
Here’s a quote from an email that one user sent to Kyle this week.
Firefox was leaking about 1.5GB per hour for me. It started with Firefox 3. I tracked it down to Ghostery and NoScript, but even without those addons it leaked about 500MB per hour of browsing.
GC and CC times got up into the 10 second range. Ugly. Really really ugly! And this is on top of the line massively overclocked hardware, too. I had to install a new addon to add a restart button to Firefox, because Firefox froze solid after hitting 2GB of memory usage. I also patched it after every update to allow up to 4GB, buying a little more time…
Then your patch comes along and solves it all… you are awesome man – totally awesome!
Another user — one who uses the leaky Autopager add-on — commented on Kyle’s blog.
Certainly, before this fix I would find that Firefox often became sluggish (input lag, slow paint operations, less than silky smooth scroll animations) as the memory usage built up. It’s hard to say how much various factors contributed to the whole, but GC pauses did undoubtedly cause the scroll animation stuttering.
Restarting was the cure. I haven’t noticed the same symptoms since, and while I haven’t had enough chance to make a conclusive judgement, the signs certainly seem to be good.
I have a full tab strip more often than not, and Fx set to load tabs from last time. This is offset by the wonderful and elegantly simple tabs on demand feature. I’m running a 2 year old laptop with 4GB ram.
And while we’re on the topic, here’s a comment from my blog.
Opened my firefox today, 30+ Tabs (only counting the ones in the active group, the others aren’t loaded), using just little more than 330 MB of RAM. A year ago, with Firefox 4, this would have been impossible. Keep it going!
Good times.
The following add-ons had zombie compartments fixed: Youtube Ratings Preview, SPDY Indicator It’s likely these leaks would have been fixed by Kyle’s change, but since Firefox 15 won’t be released until August 28, it’s good that they’ve been fixed now. (Indeed, the AMO review policy still requires that add-ons not cause zombie compartments with the current release of Firefox; that policy may be revisited once Firefox 15 is released.)
Compartment-per-global
The other big news is that compartment-per-global (CPG) landed, thanks to the work of various people, especially Luke Wagner and Bobby Holley. Bobby explained what this means and explored some of the consequences.
CPG will allow lots of things within Firefox to become simpler and faster. The main disadvantage is, unfortunately, increased memory consumption, as can be seen on areweslimyet.com. (Thanks to Luke, this increase was less than it could have been.) This is mostly due to more fragmentation in the JavaScript heap — we now have many more compartments, and each 4KB heap arena cannot be shared between compartments, so there are many more partially empty arenas present.
You might think this would make me bang my head against the wall in frustration, but it doesn’t. That’s because even if I ignore the many non-MemShrink-related benefits of CPG, there are two big MemShrink-related ones.
First, CPG will enable per-tab memory reporting, something that users have been requesting for years.
Second, CPG will lead to much more detail in about:memory and about:compartments. For example, Nils Maier has written a patch that makes it obvious all the JavaScript modules that have been loaded. Another example: Justin Dolske found that plusone.google.com was doing something silly (constantly creating new iframes?) that caused huge numbers of compartments to be created; without CPG I think all those globals would have been lumped into a single compartment and the problem would have been much less obvious. More information in about:memory will lead to more diagnosis of existing problems — particularly leaks of various kinds — in both Firefox and websites.
Memory Reporting
Kevin Locke tweaked the JS memory reporters so that more compartments are distinguished, instead of being lumped together. This was his first Mozilla patch — well done, Kevin!
Nathan Froyd improved the coverage of the layout memory reporters. This significantly reduces “heap-unclassified” for huge pages like the single-page version of the HTML5 spec.
Bug counts
Here are the current bug counts.
- P1: 22 (-2/+3)
- P2: 83 (-6/+4)
- P3: 105 (-5/+6)
- Unprioritized: 3 (-1/+3)
Mostly bouncing around at the moment.
