Last Comment Bug 727552 - Galaxytoolbar add-on creates zombie compartments
: Galaxytoolbar add-on creates zombie compartments
Status: RESOLVED FIXED
[MemShrink]
:
Product: Core
Classification: Components
Component: General (show other bugs)
: unspecified
: All All
: -- normal (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
:
Mentors:
Depends on:
Blocks: LeakyAddons ZombieCompartments
  Show dependency treegraph
 
Reported: 2012-02-15 11:32 PST by Kris Maglione [:kmag]
Modified: 2012-02-16 14:11 PST (History)
2 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments

Description Kris Maglione [:kmag] 2012-02-15 11:32:49 PST
The Galaxytoolbar add-on[1] creates zombie compartments for the web pages it interacts with. As far as I can tell, zombie compartments replace previous zombie compartments rather than accumulating.


[1] https://addons.mozilla.org/addon/galaxytoolbar/
Comment 1 Kris Maglione [:kmag] 2012-02-15 11:36:07 PST
CCing developer.
Comment 2 Jan Wedding 2012-02-15 12:18:58 PST
Yes, thanks for finding that. I am on to fix it.
Comment 3 Jan Wedding 2012-02-15 14:22:13 PST
OK. Just to give some feedback for the moment.

I already found two issues which caused memory leaks in my extension:
- I always stored a reference to the last opened document handled by my extension in an object property of my AddOn
- I had some undeclared variables (no "var"),  assigned DOM Elements to them, and after my function was over, a compartment of the whole document stayed in Firefox Memory. Seems as if I polluted global namespace and so the GC was not able to recognize that the document reference could be cleaned from memory.

The second issue was quite hard to find, and I need to investigate further, if something like this is in other parts of my AddOn
Comment 4 Nicholas Nethercote [:njn] 2012-02-15 16:11:24 PST
(In reply to Jan from comment #3)
> OK. Just to give some feedback for the moment.
> 
> I already found two issues which caused memory leaks in my extension:
> - I always stored a reference to the last opened document handled by my
> extension in an object property of my AddOn
> - I had some undeclared variables (no "var"),  assigned DOM Elements to
> them, and after my function was over, a compartment of the whole document
> stayed in Firefox Memory. Seems as if I polluted global namespace and so the
> GC was not able to recognize that the document reference could be cleaned
> from memory.
> 
> The second issue was quite hard to find, and I need to investigate further,
> if something like this is in other parts of my AddOn

Use "use strict;"!  https://developer.mozilla.org/en/JavaScript/Strict_mode
Comment 5 Jan Wedding 2012-02-16 13:07:28 PST
Ok, I uploaded a new version to AMO (v2.6.12). This version should fix zombie compartments and another leak, which I found while testing. (sqlite-dbconnection wasn't closed properly in the options window when there were asynch operations waiting)
Comment 6 Kris Maglione [:kmag] 2012-02-16 14:11:21 PST
Thanks for the quick fix.

Note You need to log in before you can comment on or make changes to this bug.