Memory leaks can cause the browser to slow down and even crash in some circumstances

Aug 30, 2012 09:51 GMT  ·  By

Mozilla has been working on bringing down memory usage in Firefox for a while now, but accelerated efforts about a year ago with the MemShrink project. Since then, the big problems with Firefox have been fixed, so the latest big patch is actually for add-ons.

Firefox 15 has a fix that should prevent the most common and problematic add-on memory leaks. The fix should be great for performance and memory usage, in most cases, but it can cause issues in some isolated situations.

What's more, the fix doesn't guarantee that all add-on leaks have been plugged, that's clearly not the case. Which is why Mozilla is urging add-on developers to test their creations and see if they leak. After all, who's in a better position to fix leaky add-ons than the people who created them?

"To ensure people continue to have a good browsing experience while using the add-ons they love, please do your part in testing your add-ons. The fix in Firefox 15 handles most instances of Zombie Compartments, but that doesn’t mean they can’t still be created," Mozilla wrote.

Zombie Compartments are memory compartments created by add-ons that remain in memory even though they are no longer used, a classic memory leak. This happens because add-ons store parts of a website in memory even after users close the tab it was being used for.

The fix in Firefox 15 addresses this issue. But there are other ways in which an add-on can cause memory leaks and the fix may still not work for all zombie compartment leaks. The problem is that leaks can be hard to pinpoint and discover, especially by developers who may not have great experience testing their code in various use cases.

"This MDN article includes pointers on how to find these types of leaks and how to avoid them. The main take-away is this: don’t hold any references to DOM objects after the document is closed. Your help in testing both the add-ons you’ve created and the add-ons you use is vital, and greatly appreciated," Mozilla added.