Changes between Version 2 and Version 3 of Abandoned documents


Ignore:
Timestamp:
Aug 18, 2018 1:04:57 PM (6 years ago)
Author:
Simon Fraser
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Abandoned documents

    v2 v3  
    77= Why are layout test results showing me a list of abandoned documents? =
    88
    9 Because leaked 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]
     9Leaked 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
    1111= What should I do if see a new case of document abandonment? =
    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.
     14
     15= How do I debug document abandonment? =
     16
     17Let's take an example [https://bugs.webkit.org/show_bug.cgi?id=188722]. We run tests, checking for abandonment:
     18
     19{{{
     20run-webkit-tests fast/forms/ --check-for-abandoned-documents
     21}}}
     22
     23The results say that {{{fast/forms/textarea-paste-newline.html}}} was abandoned. Now you have to figure out why this Document object is not going away.
     24
     25A bit of testing in MiniBrowser can be useful, and if you're lucky, the abandonment will reproduce there. To test this, do these steps:
     261. Run MiniBrowser
     272. Load a simple HTML file (not the test!)
     283. Load the test file
     294. Go back to the simple HTML file
     305. Simulate a memory warning (on macOS, you can do this by running {{{notifyutil -p "org.WebKit.lowMemory"}}} in the Terminal).
     316. Now dump the list of live documents: {{{notifyutil -p "com.apple.WebKit.showAllDocuments"}}}. This will show something like:
     32{{{
     332 live documents:
     34Document 0x630002400 (refCount 5, referencingNodeCount 1) file:///Volumes/Data/webkit/LayoutTests/fast/forms/textarea-paste-newline.html
     35Document 0x630024400 (refCount 2, referencingNodeCount 4) file:///Volumes/Data/simple.html
     36}}}
     377. That confirms that after a memory warning (which clears caches and does a GC) that the document is still alive. So something is holding a reference to it.