I'm involved into developing of Firefox extension. Our extension is complex and we have problems with permanent zombie compartments. Mozilla Zombie compartments page gives only general information and just introduces into the problem and testing approaches.
So, i want to ask if somebody knows common bottlenecks and problematic design patterns (or simply, known bugs and fails) and best practices how to deal with them.
Added: Here is a good link of common causes of memory leaks in extensions. Any other suggestions?
The most common failure mode is storing references to web pages for too long. This can happen for several reasons that I've seen:
Basically, any time you're working with something from a web page, make sure you never assign it to anything other than a local variable declared with var and that you don't create new long-lived functions closing over it. Those two things will help with a large fraction of cases.
Note that none of that is specific to Firefox extensions; it applies to all coding in JavaScript...