Lots of activity this week.
I created a new devmo wiki page documenting common causes of memory leaks in add-ons. I based this on a lovely selection of examples provided by Nils Maier. Unfortunately, I know almost nothing about writing add-ons and so I’m not happy with the current state of the documentation. I’ve taken it as far as I can, but it very likely has errors, leaves out important cases, conflates distinct concepts, and generally is not as good as it should be. This documentation is really important — we have good tools for identifying when add-on leaks occur but we don’t yet have good tools for identifying their causes. Until we have those tools, documentation is the only way we can help add-on authors fix leaks. If someone who knows more about add-ons is willing to help please contact me!
Alexandre Poirot fixed a leak in the Add-on SDK that was causing zombie compartments when certain add-ons were disabled. This also fixed bug 725603 and probably fixes some zombie compartments reported in some other add-ons (e.g. MemChaser).
Jan fixed several leaks in the Galaxytoolbar add-on. The new version is 2.6.12.
I landed support for a new page called about:compartments. The exposure of zombie compartments in about:memory has become an extremely powerful leak detection tool. But using about:memory to find zombies is non-trivial — there are multiple steps and ways to get it wrong. The motivation for about:compartments is to make the detection of zombie compartments as simple as possible. Here’s a screenshot:
Some things to note:
- It only shows compartments, and all of them.
- User compartments from web content (usually the interesting ones) are listed separately from system compartments.
- The garbage and cycle collectors are automatically run when the page is loaded, ensuring that dead compartments aren’t listed.
- The “More verbose” link at the bottom just causes the truncated URLs to be shown in full.
- about:compartments shares a lot of code with about:memory.
- I updated the documentation on zombie compartments accordingly.
Olli Pettay created about:cc, an add-on that can detect various kinds of document leaks relating to cycle collection. Olli has already found several leaks with this tool. Jan Honza Odvarko has written about:ccdump, a similar but prettier add-on. I’m not certain but I think Olli and Jan are now co-ordinating their efforts.
I mentioned Mozilla QA’s MemChaser add-on a few weeks ago. It lets you track memory usage and GC/CC activity easily via the add-on bar, and also allows logging of memory-related activities. It’s now available on AMO, which guarantees you’ll receive updates as they’re released.
Jesse Ruderman tweaked his DOM fuzzer and found several new small leaks relating to nsITimers. Jesse also modified about:memory so that it produces assertions that his fuzzer will catch. This means that his fuzzer will detect if any memory reporters produce bogus values.
Kyle Huey fixed a zombie compartment that occurred when searching within pages with onclick handlers, which is a pretty common operation.
Jeff Muizelaar fixed a huge Mac-only leak relating to text rendering. This was a recent regression that isn’t present in any released version of Firefox.
Josh Aas fixed a bug in cookie clearing — prior to Josh’s fix, if you cleared all cookies, Firefox would launch an instance of the plugin-container process for every plug-in installed, which could cause freezes and memory spikes.
This week’s bug counts:
- P1: 28 (-1/+3)
- P2: 134 (-6/+9)
- P3: 79 (-8/+11)
- Unprioritized: 2 (-1/+2)
Lots of movement there: plenty of bugs fixed, but even more new ones. Roughly 20 of the new ones fell into the following three categories.
- Zombie compartments found in AMO add-ons by Kris Maglione and Andreas Wagner.
- Leaks found by Olli Pettay’s new about:cc tool, mentioned above.
- Leaks found by Jesse Ruderman’s tweaked DOM fuzzer, mentioned above.
This is a good thing! It shows that new policies and tools are exposing existing problems. I expect this higher level of new bug filing will continue for a couple of weeks.