Detached DOM and event listeners
These tools are in the dom toolset. Starting the server with
MEMLAB_TOOLSETS=dom exposes only them, plus the few tools every
session needs, and memlab_tools({enable: "dom"}) turns them on
in a session. Try them in the order listed.
| Tool | Use it when |
|---|---|
memlab_dom_audit | Budget the ATTACHED DOM and rank surfaces worth virtualizing. An OPTIMIZATION tool — these elements are correctly retained, there are simply too many. |
memlab_detached_dom | Detached nodes, with a pinned-vs-GC-eligible split; group_by:"dominator" groups by what a fix would actually free (and lists every reference into a top group of 1,000+ nodes), and baseline adds each group's count at an earlier rung and sorts by the change. On a minified build the top owner's path starts at the holding module; raw_paths: true keeps the registry hops. Over a ladder (run_dir), DOM elements and Blink internals are counted on separate lines, and the settle rung is a final column with a HELD / DRAINED verdict per row; a drained row never reads as a STEP or LINEAR leak. |
memlab_observer_census | Web Animations and Mutation / Resize / Intersection observers, each with its targets split attached / DETACHED, its callback and its holder (a JS owner, or the browser alone); per rung with run_dir. Finds the animation or observer that keeps a detached element alive, which document.getAnimations() does not list. |
memlab_event_listener_leaks | Listeners that outlived their target. |
memlab_event_registry | What is registered on what; group_by emitter × context class × callback says whose listener records they are, per rung with run_dir; a growing row whose callback is a library wrapper (the Arbiter → r) also names the subscriber behind it. |
memlab_duplicate_subscriptions | The same callback code subscribed more than once for the same subscriber, on an emitter event, a listener Set or a DOM target — fresh closures included — and which groups grew across rungs. |