Changes between Version 7 and Version 8 of Abandoned documents


Ignore:
Timestamp:
Aug 30, 2018 2:28:13 PM (6 years ago)
Author:
Simon Fraser
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Abandoned documents

    v7 v8  
    33Abandoned documents are effectively leaked: they are Document objects which have never been destroyed, and persist after loading about:blank, running a garbage collection and clearing caches. This is probably because there's some object that is holding a reference to the Document object, possibly in the GC heap, or via a retain cycle (often involving Nodes in the document).
    44
    5 All documents are referenced by Document::allDocumentsMap(), so they are not leaked in the sense that the 'leaks' tool doesn't show them.
     5All documents are referenced by Document::allDocumentsMap(), so they are not leaked in the sense that the 'leaks' tool doesn't show them, but we refer to them as a "world leak" (i.e. a leak of a high-level object that tends to entrain lots of other objects).
    66
    7 = Why are layout test results showing me a list of leaked documents? =
     7= Why are layout test results showing me tests with leaks? =
    88
    99Leaked documents usually entrain a lot of other objects, which can use lots of memory (e.g. via entries in the memory cache). Leaking documents is bad because it will cause ever-increasing memory use as the user browses. See [https://bugs.webkit.org/show_bug.cgi?id=186214]
    1010
    11 = What should I do if see a new case of document abandonment? =
     11= What should I do if see a new document leak? =
    1212
    1313If you made a code change that is causing a test to newly show that a document is leaked, it probably means you have a coding bug that is triggered a leak or (more likely) a reference cycle. You need to resolve this before committing.
    1414
    15 = How do I debug document abandonment? =
     15= How do I debug document leaks? =
    1616
    1717Let's take an example [https://bugs.webkit.org/show_bug.cgi?id=188722]. We run tests, checking for world leaks:
     
    2323The results say that {{{fast/forms/textarea-paste-newline.html}}} was leaked. Now you have to figure out why this Document object is not going away.
    2424
    25 A bit of testing in MiniBrowser can be useful, and if you're lucky, the abandonment will reproduce there. To test this, do these steps:
     25A bit of testing in MiniBrowser can be useful, and if you're lucky, the leak will reproduce there. To test this, do these steps:
    26261. Run MiniBrowser
    27272. Load a simple HTML file (not the test!)