Closed Bug 385376 Opened 17 years ago Closed 17 years ago

Memory leak when closing a tab

Categories

(Core :: DOM: Events, defect)

defect
Not set
normal

Tracking

()

VERIFIED FIXED
mozilla1.9alpha8

People

(Reporter: stevee, Assigned: dbaron)

References

Details

(Keywords: memory-leak)

Attachments

(1 file, 1 obsolete file)

Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9a6pre) Gecko/20070621 Minefield/3.0a6pre ID:2007062107

1. New profile, start firefox with leak-logging enabled
2. Close firefox (so bug 385045 doesn't pollute our results)
3. Restart firefox with same profile & leak-logging enabled
4. Middle click on the "Getting Started" link on the bookmarks toolbar.
5. Let the page load, then close the tab with the [x] on its right hand side
6. Close Firefox
7. Analyse nspr.log

Leaked inner window 1c9f4d8 (outer 2581538) at address 1c9f4d8.
 ... with URI "http://www.mozilla.org/projects/minefield/".
Leaked inner window 1c978c8 (outer 1c7fc48) at address 1c978c8.
 ... with URI "about:blank".
Leaked outer window 2581538 at address 2581538.
Leaked outer window 1c7fc48 at address 1c7fc48.
Leaked document at address 1f6b418.
 ... with URI "jar:file:///C:/Documents%20and%20Settings/Ste/Desktop/Firefox%20T
runk%20(PLACES)/firefox/chrome/toolkit.jar!/content/global/bindings/scrollbox.xm
l".
 ... with URI "chrome://global/content/bindings/scrollbox.xml".
Leaked document at address 1eeb298.
 ... with URI "jar:file:///C:/Documents%20and%20Settings/Ste/Desktop/Firefox%20T
runk%20(PLACES)/firefox/chrome/browser.jar!/content/browser/places/menu.xml".
 ... with URI "chrome://browser/content/places/menu.xml".
Leaked document at address 1c935d8.
 ... with URI "http://www.mozilla.org/projects/minefield/".
Leaked document at address 1f869c8.
 ... with URI "jar:file:///C:/Documents%20and%20Settings/Ste/Desktop/Firefox%20T
runk%20(PLACES)/firefox/chrome/toolkit.jar!/content/global/bindings/tabbox.xml".

 ... with URI "chrome://global/content/bindings/tabbox.xml".
Leaked document at address 256f048.
 ... with URI "jar:file:///C:/Documents%20and%20Settings/Ste/Desktop/Firefox%20T
runk%20(PLACES)/firefox/chrome/toolkit.jar!/content/global/bindings/browser.xml"
.
 ... with URI "chrome://global/content/bindings/browser.xml".
Leaked document at address 1d04c90.
Leaked document at address 1eca818.
 ... with URI "chrome://global/content/bindings/tree.xml".
 ... with URI "jar:file:///C:/Documents%20and%20Settings/Ste/Desktop/Firefox%20T
runk%20(PLACES)/firefox/chrome/toolkit.jar!/content/global/bindings/tree.xml".
Leaked document at address 1f00008.
 ... with URI "jar:file:///C:/Documents%20and%20Settings/Ste/Desktop/Firefox%20T
runk%20(PLACES)/firefox/chrome/toolkit.jar!/content/global/bindings/splitter.xml
".
 ... with URI "chrome://global/content/bindings/splitter.xml".
Leaked document at address 1ea37f8.
 ... with URI "chrome://global/content/bindings/text.xml".
 ... with URI "jar:file:///C:/Documents%20and%20Settings/Ste/Desktop/Firefox%20T
runk%20(PLACES)/firefox/chrome/toolkit.jar!/content/global/bindings/text.xml".
Leaked document at address 1eb3df0.
 ... with URI "jar:file:///C:/Documents%20and%20Settings/Ste/Desktop/Firefox%20T
runk%20(PLACES)/firefox/chrome/toolkit.jar!/content/global/bindings/autocomplete
.xml".
 ... with URI "chrome://global/content/bindings/autocomplete.xml".
Leaked document at address 25856a8.
 ... with URI "chrome://global/content/bindings/findbar.xml".
 ... with URI "jar:file:///C:/Documents%20and%20Settings/Ste/Desktop/Firefox%20T
runk%20(PLACES)/firefox/chrome/toolkit.jar!/content/global/bindings/findbar.xml"
.
Leaked document at address 24f0a10.
 ... with URI "chrome://global/content/platformHTMLBindings.xml".
 ... with URI "jar:file:///C:/Documents%20and%20Settings/Ste/Desktop/Firefox%20T
runk%20(PLACES)/firefox/chrome/toolkit.jar!/content/global/platformHTMLBindings.
xml".
Leaked document at address 1fd2458.
 ... with URI "jar:file:///C:/Documents%20and%20Settings/Ste/Desktop/Firefox%20T
runk%20(PLACES)/firefox/chrome/toolkit.jar!/content/global/bindings/button.xml".

 ... with URI "chrome://global/content/bindings/button.xml".
Leaked document at address 24b9008.
 ... with URI "chrome://global/content/bindings/textbox.xml".
 ... with URI "jar:file:///C:/Documents%20and%20Settings/Ste/Desktop/Firefox%20T
runk%20(PLACES)/firefox/chrome/toolkit.jar!/content/global/bindings/textbox.xml"
.
Leaked document at address 2525558.
 ... with URI "chrome://global/content/bindings/notification.xml".
 ... with URI "jar:file:///C:/Documents%20and%20Settings/Ste/Desktop/Firefox%20T
runk%20(PLACES)/firefox/chrome/toolkit.jar!/content/global/bindings/notification
.xml".
Leaked document at address 250a718.
 ... with URI "chrome://browser/content/search/search.xml".
 ... with URI "jar:file:///C:/Documents%20and%20Settings/Ste/Desktop/Firefox%20T
runk%20(PLACES)/firefox/chrome/browser.jar!/content/browser/search/search.xml".
Leaked document at address 1fac350.
 ... with URI "jar:file:///C:/Documents%20and%20Settings/Ste/Desktop/Firefox%20T
runk%20(PLACES)/firefox/chrome/classic.jar!/skin/classic/global/globalBindings.x
ml".
 ... with URI "chrome://global/skin/globalBindings.xml".
Leaked document at address 1ea06a8.
 ... with URI "jar:file:///C:/Documents%20and%20Settings/Ste/Desktop/Firefox%20T
runk%20(PLACES)/firefox/chrome/toolkit.jar!/content/global/bindings/general.xml"
.
 ... with URI "chrome://global/content/bindings/general.xml".
Leaked document at address 1f2e008.
 ... with URI "chrome://global/content/bindings/tabbrowser.xml".
 ... with URI "jar:file:///C:/Documents%20and%20Settings/Ste/Desktop/Firefox%20T
runk%20(PLACES)/firefox/chrome/toolkit.jar!/content/global/bindings/tabbrowser.x
ml".
Leaked document at address 1e96800.
 ... with URI "chrome://browser/content/urlbarBindings.xml".
 ... with URI "jar:file:///C:/Documents%20and%20Settings/Ste/Desktop/Firefox%20T
runk%20(PLACES)/firefox/chrome/browser.jar!/content/browser/urlbarBindings.xml".

Leaked document at address 1fdb8b8.
 ... with URI "jar:file:///C:/Documents%20and%20Settings/Ste/Desktop/Firefox%20T
runk%20(PLACES)/firefox/chrome/browser.jar!/content/browser/places/toolbar.xml".

 ... with URI "chrome://browser/content/places/toolbar.xml".
Leaked document at address 25af3d8.
 ... with URI "chrome://global/content/bindings/progressmeter.xml".
 ... with URI "jar:file:///C:/Documents%20and%20Settings/Ste/Desktop/Firefox%20T
runk%20(PLACES)/firefox/chrome/toolkit.jar!/content/global/bindings/progressmete
r.xml".
Leaked document at address 1e1a008.
 ... with URI "jar:file:///C:/Documents%20and%20Settings/Ste/Desktop/Firefox%20T
runk%20(PLACES)/firefox/chrome/toolkit.jar!/content/global/bindings/popup.xml".
 ... with URI "chrome://global/content/bindings/popup.xml".
Leaked document at address 1ebe2f0.
 ... with URI "jar:file:///C:/Documents%20and%20Settings/Ste/Desktop/Firefox%20T
runk%20(PLACES)/firefox/chrome/toolkit.jar!/content/global/bindings/stringbundle
.xml".
 ... with URI "chrome://global/content/bindings/stringbundle.xml".
Leaked document at address 1eec1f8.
 ... with URI "jar:file:///C:/Documents%20and%20Settings/Ste/Desktop/Firefox%20T
runk%20(PLACES)/firefox/chrome/toolkit.jar!/content/global/bindings/menu.xml".
 ... with URI "chrome://global/content/bindings/menu.xml".
Leaked document at address 1f16b78.
 ... with URI "chrome://global/content/bindings/toolbar.xml".
 ... with URI "jar:file:///C:/Documents%20and%20Settings/Ste/Desktop/Firefox%20T
runk%20(PLACES)/firefox/chrome/toolkit.jar!/content/global/bindings/toolbar.xml"
.
Leaked document at address 1f7e6d8.
 ... with URI "jar:file:///C:/Documents%20and%20Settings/Ste/Desktop/Firefox%20T
runk%20(PLACES)/firefox/chrome/toolkit.jar!/content/global/bindings/toolbarbutto
n.xml".
 ... with URI "chrome://global/content/bindings/toolbarbutton.xml".
Summary:
Leaked 4 out of 10 DOM Windows
Leaked 27 out of 41 documents
Leaked 0 out of 4 docshells
Flags: blocking-firefox3?
OS: Windows 2000 → All
Hardware: PC → All
Summary: Memory leak when closing a tab? → Memory leak when closing a tab
It looks like this would be fixed if cycle collection traversed:
  nsDOMEvent::mPresContext
  nsPresContext::mDocument
  nsPresContext::mEventManager
  nsEventStateManager::mDocument
But adding nsPresContext to cycle collection such that things really don't leak may involved adding traversal to a good bit more than just that.
Component: General → DOM: Events
Flags: blocking-firefox3?
Product: Firefox → Core
QA Contact: general → events
Actually, there's an easier solution, since nsDOMEvents really don't need to hold on to the pres context, as far as I can tell.  Patch shortly, if it works.
Er, well, that's a bit harder than I thought -- forgot to look at nsDOMUIEvent, which uses it a bit more (although it's still a potentially reasonable alternative approach).
Assignee: nobody → dbaron
Attached patch patch (obsolete) — Splinter Review
This fixes the bulk of the leaks, but there are a few left.  I need to look into whether that's because this patch is missing something...
Attached patch patchSplinter Review
The other leaks I was seeing are an unrelated trunk regression.
Attachment #275180 - Attachment is obsolete: true
Attachment #275183 - Flags: superreview?(jst)
Attachment #275183 - Flags: review?(Olli.Pettay)
Attachment #275183 - Flags: superreview?(jst) → superreview+
Attachment #275183 - Flags: review?(Olli.Pettay) → review+
Flags: blocking1.9? → blocking1.9+
Attachment #275183 - Flags: approval1.9? → approval1.9+
Fix checked in to trunk, 2007-08-10 14:25.
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9 M8
Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9a8pre) Gecko/2007081423 Minefield/3.0a8pre ID:2007081423
--> VERIFIED
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: