Open Bug 740523 Opened 12 years ago Updated 2 years ago

Mark likely-leaked windows and documents as black for most CCs

Categories

(Core :: General, defect)

defect

Tracking

()

People

(Reporter: justin.lebar+bug, Assigned: smaug)

Details

(Whiteboard: [Snappy:P2])

Attachments

(1 file, 2 obsolete files)

So we have lots of cool optimizations to keep us from traversing active windows and their child objects.  But all of these optimizations are useless as soon as we leak a window, whether due to a bug in Firefox or an add-on.  Then we traverse all of the window's objects on every CC.

In the case when our CC times are too long, perhaps we should stop traversing these likely-leaked windows' objects.  We can say, if CC times are longer than X and a window has survived Y CCs since it was destroyed, mark it as black for most CCs.

We can then do a full CC, with no pre-emptive black marking, upon idle, or once every 5 minutes, or something.
This bug might mitigate a lot of the jank we see due to zombie compartments.
Whiteboard: [snappy]
Assignee: nobody → bugs
OS: Mac OS X → All
Hardware: x86 → All
Version: unspecified → Trunk
Summary: Mark likely-leaked windows as black for most CCs → Mark likely-leaked windows and documents as black for most CCs
Attached patch wip (obsolete) — Splinter Review
Something like this could work. Try to first CC possible zombie
reasonable aggressively, but if that doesn't help, do it more rarely.
But, at some point try to collect all the zombies.
Attachment #611778 - Flags: feedback?(continuation)
Attached patch wip 2 (obsolete) — Splinter Review
This is a bit better. static svg-as-image documents don't end up to the
CC graph after loading.
Attachment #611778 - Attachment is obsolete: true
Attachment #611778 - Flags: feedback?(continuation)
Attachment #611796 - Flags: feedback?(continuation)
Hmm, that isn't quite good. if (mHasHadScriptHandlingObject) check removes also all the
XBL documents from zombie list.
Attached patch WIP3Splinter Review
Don't mark resource documents (svg-as-image and others) as zombies. They
are handled pretty differently.
Attachment #611796 - Attachment is obsolete: true
Attachment #611796 - Flags: feedback?(continuation)
Attachment #611908 - Flags: feedback?(continuation)
Testing this now locally. Unfortunately I get zombies quite rarely.

I wonder if I should rename nsZombieCycleCollectable to PossibleZombieCycleCollectable.
Hmm, I'm leaking, badly.
Comment on attachment 611908 [details] [diff] [review]
WIP3

I don't know yet what causes the leak, but I assume it is this patch.
Attachment #611908 - Flags: feedback?(continuation)
Interesting. If I reload facebook, something keeps the document alive long enough so that
it ends up being a zombie, and then, I think, because the patch doesn't try to collect it always
it ends up staying alive.
I guess simpler, and more conservative patch is needed. Try to collect X (X ~ 10 ?) times, and if
the document is still alive, mark it to be a possible zombie.
> Interesting. If I reload facebook, something keeps the document alive long enough so that
> it ends up being a zombie, and then, I think, because the patch doesn't try to collect it always
> it ends up staying alive.

You may need a heuristic like ghost windows have, where if you have some FB page open, you try to collect all FB pages.

Or alternatively, can you tell whether the window has any content pointers to it?
Whiteboard: [snappy] → [Snappy:P2]

The bug assignee is inactive on Bugzilla, so the assignee is being reset.

Assignee: smaug → nobody

Sorry, there was a problem with the detection of inactive users. I'm reverting the change.

Assignee: nobody → smaug
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: