Opened 12 years ago

Last modified 12 years ago

#495 closed defect (Fixed)

Memory leaks in torbutton

Reported by: arno Owned by: mikeperry
Priority: Low Milestone:
Component: Applications/Torbutton Version: 1.1
Severity: Keywords:
Cc: arno, nickm Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

Hi,
I noticed some memory leaks in torbutton.
So, I tested with development branch, and they were still here. Those leaks come
from pref observer not being removed during window unloading. When you use
just one window, that's not a big deal, but if you use multiple, some
javascripts objects are leaked each time.

Here is a patch to apply against last version
(http://torbutton.torproject.org/dev/torbutton-current-alpha.xpi 1.1.6 30 Jul 2007)

PS: I noticed those leaks with leak monitor, a nice tool for xul developers:
http://dbaron.org/mozilla/leak-monitor/

--- torbutton.js 2007-09-06 23:29:18.000000000 +0200
+++ /home/arno/.mozilla/firefox/qrp98gfd.tes/extensions/{e0204bd5-9d31-402b-a99d-a6aa8ffebdca}/chrome/content/torbutton.js 2007-09-06 23:31:59.000000000 +0200
@@ -20,7 +20,7 @@

unregister: function()
{

if (!this._branch) return;

  • this._branch.removeOberver("", this);

+ this._branch.removeObserver("", this);

},


topic: what event occurred

@@ -838,6 +838,10 @@

Components.interfaces.nsIWebProgress.NOTIFY_LOCATION);

}


+function torbutton_close_window(event) {
+ torbutton_pref_observer.unregister();
+}
+

Technique courtesy of:
http://xulsolutions.blogspot.com/2006/07/creating-uninstall-script-for.html
const TORBUTTON_EXTENSION_UUID = "{E0204BD5-9D31-402B-A99D-A6AA8FFEBDCA}";

@@ -884,6 +888,7 @@

}


window.addEventListener('load',torbutton_new_window,false);

+window.addEventListener('unload', torbutton_close_window, false);

getBrowser().addEventListener("TabOpen", torbutton_new_tab, false);



[Automatically added by flyspray2trac: Operating System: All]

Child Tickets

Change History (2)

comment:1 Changed 12 years ago by nickm

(Changed bug desription to "Memory leaks in torbutton" from "Kxv2lCt*". I hope that wasn't your password or something.)

comment:2 Changed 12 years ago by mikeperry

flyspray2trac: bug closed.
Patch applied, it will go in my next commit. Thanks!

Note: See TracTickets for help on using tickets.