Hi,
Today I realized that require('sdk/tabs') leaks memory... quite
some if you ask me...
around 100MB RAM for around
50
windows opened and then closed
Long short story.... I created a jetpack add-on a while ago... I
checked for memory leaks in
about:memory and realized that leaks
memory every time I open a new window... Seems that every single new
window created and then closed will remain in
--top(none)/detached
and Garbage Collection will never free that space.
Since I was creating XUL overlays with Addon SDK (so.. working
at the browser window level not add-on) I thought that it was a
error from my code and after countless days of tracking I realized
that I will probably never find the problem and decide to keep the
addon just for myself... I never expected that a simple require for
a SDK module to be the problem
Today I decided to check again the problem and realized that a
simple
require('sdk/tabs') does the trick... basically I
created a simple addon with just 3 lines in
main.js
var tabs = require('sdk/tabs');
exports.main = function (options,
callbacks) {};
exports.onUnload = function (reason) {};
Steps to reproduce:
1) install the add-on (I used the latest available SDK
1.17, but from what I know it should use the one integrated in
Firefox...)
2) open as many new windows as you want then close them
(leave 1 open)
3)
about:memory - measure memory, look for
--top(none)/detached
4) Garbage collection or cycle collection or
minimize memory usage does nothing
- you can wait as much as you want but that memory will
never be freed... tried that
- tested on a clean profile with Firefox 34, seems that
Nighly will never free the memory even if I disable the addon
5) disable the add-on
6) do a GC or wait for it
7) measure memory usage => memory is freed
I created a test addon:
https://www.dropbox.com/s/j3d4iq5gqn8ql3a/leak-test.xpi?dl=0
Can anyone please confirm this memory leak bug? I couldn't find
it on Bugzilla... and still not sure If I'm doing something wrong or
not, but In 3 lines of code I guess I shouldn't :D
How does this affect add-on reviews ?
I know a lot of people that don't close Firefox too often and
during a full day of browsing (or maybe more), several windows can
be opened .. 2MB for every single opened window is something
Thanks a lot,
Gabriel Ivanica