Closed Bug 158066 Opened 22 years ago Closed 17 years ago

Potential leak of window object because of self-cycle with opener

Categories

(Core :: DOM: Core & HTML, defect, P3)

defect

Tracking

()

RESOLVED FIXED
mozilla1.9beta3

People

(Reporter: keeda, Assigned: smaug)

References

Details

(Keywords: memory-leak, testcase)

Attachments

(2 files)

Here is another one of my "strange case" leak reports.

The testcase that I am about to to attach will cause mozilla to leak a
GlobalWindow object.

What is happening here is that the GlobalWindow holds on to a strong ref to its
opener   

nsCOMPtr<nsIDOMWindowInternal> mOpener;

But the opener can potentially be itself. So it end up having a ref to itself
and leaking. Everything that it owns goes with it.

I dunno how you are going to fix this, or if it is even worth fixing  :-/
err .. sorry ... typo in summary.
Summary: Pothential leak of window object because of self-cycle with opener → Potential leak of window object because of self-cycle with opener
nice....

Would it be possible to use something similar to create a loop with more than
one window in it?  Or do we just need to deal with the foo.opener == foo case?
Keywords: mlk
OS: Windows 2000 → All
Hardware: PC → All
Just did some testing with that testcase.  It doesn't leak any webshells, which
makes it leaking a window seem unlikely....
Yeah. Its not as bad as I initially thought.

We end up realeasing most (probably all) of the stuff that the window holds
since SetDocShell(null) does get called. But we do leak the GlobalWindow object
itself.
Mass-reassigning bugs to dom_bugs@netscape.com
Assignee: jst → dom_bugs
I see a nsGlobalWindow leak with the testcase, using Mac trunk debug.
Flags: blocking1.9?
Keywords: testcase
Comment on attachment 292303 [details] [diff] [review]
possible patch

I run mochitest with many windows open and there weren't any problems.
Attachment #292303 - Flags: superreview?(peterv)
Attachment #292303 - Flags: review?(peterv)
Flags: blocking1.9? → blocking1.9+
Priority: -- → P3
Comment on attachment 292303 [details] [diff] [review]
possible patch

Does it fix this bug?
sure :)
Attachment #292303 - Flags: superreview?(peterv)
Attachment #292303 - Flags: superreview+
Attachment #292303 - Flags: review?(peterv)
Attachment #292303 - Flags: review+
Checked in
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9 M11
Flags: in-testsuite?
Blocks: 402479
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Assignee: general → Olli.Pettay
Status: REOPENED → NEW
Status: NEW → RESOLVED
Closed: 17 years ago17 years ago
Resolution: --- → FIXED
Component: DOM: Core → DOM: Core & HTML
QA Contact: stummala → general
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: