New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Each window leaks memory (only) when Vimperator is enabled #253
Comments
You're probably correct. Unfortunately, we probably won't be able to address this immediately since we have issues just trying to keep the plugin available in new version of firefox :) |
The issue happens without e10s. I can reproduce the issue. |
I work on Firefox and I've been investigating the window leaks related to Vimperator ( https://bugzilla.mozilla.org/show_bug.cgi?id=873163 ). As far as I can tell, there are at least 3 things that are keeping windows alive after they are closed.
I think maybe for 2 and 3 you might be able to convert them to using weak references, though then you'd have to deal with checking for thing that went away. |
Thanks for all the work you’ve put into it, @amccreight! |
@amccreight that's awesome. Thanks for your work. I'll definitely work on bringing these in over the weekend. |
But yeah, for 2 and 3, we probably should either convert to weak references or be super diligent in cleaning up after ourselves. Thanks @amccreight. |
To investigate things like this yourself, first reproduce the leak. Then go to about:memory and click on "Save verbose". This will give you CC and GC logs. Grep through the CC logs for nsGlobalWindow for browser.xul. One of these will be the actual window, but the ones with a lower number in rc={some number} is going to be the leaking windows. Once you have the address of one of those leaking windows, you need my find_roots script from here: and that will show you at least one reason why the window is alive, as a path from some object to the window. If the object keeping the window alive is a marked GC object, you have to run find_roots.py to find out why the GC is keeping that object alive. |
With vimperator enabled, opening a new new window and then closing it again leaks memory, which about:memory categorizes under Explicit Allocations -> explicit -> window-objects -> top(none)/detached. Likely there are other leaks as well, but this one I have confirmed explicitly.
I am running Linux, Firefox 39.0 and Vimperator 3.9.1-signed.
To Reproduce
Disable all addons except for Vimperator, and restart Firefox. Go to about:memory
then, open a new window (OS-level window, not tab), and close it again. For more dramatic results open multiple - I ran "for i in {0..10}; do firefox & done" from a shell.
now, in the about:memory window, click "Free Memory -> Minimize memory usage", then "Show memory reports -> Measure". Look at Explicit Allocations -> explicit -> window-objects -> top(none)/detached. This memory (as a lower bound) is leaked due to Vimperator.
Expected Behavior
Disable all addons, this time including Vimperator, and restart Firefox. Go through the same steps as the "To Reproduce" section above. This time, after "Minimize memory usage", "Measure" should not have any "top(none)/detached" entry.
To me, this indicates that Vimperator is probably preventing some page-level objects from being gc-ed. However I don't know much about Firefox and/or Vimperator implementations, so I'm happy to take any further measurements that help clarify.
Severity - this depends on use pattern, I guess. I always use windows instead of tabs, and do tabbing at the os/window-manager level. For me, I commonly hit about 2G of memory leak and OOM after about a day. For someone who rarely opens new windows, probably this is less of an issue.
The text was updated successfully, but these errors were encountered: