RESOLVED FIXED314996
Avoid lazy-allocating UndoManager during Document teardown
https://bugs.webkit.org/show_bug.cgi?id=314996
Summary Avoid lazy-allocating UndoManager during Document teardown
David Kilzer (:ddkilzer)
Reported 2026-05-17 20:26:27 PDT
`Document::willBeRemovedFromFrame()` calls `protect(undoManager())->removeAllItems()` unconditionally. `Document::undoManager()` lazy-creates the `UndoManager` through `ensureUndoManager()` when `m_undoManager` is null. For clients that do not create `m_undoManager`, every detached `Document` lazy-allocates a 32-byte `UndoManager`, calls a no-op `removeAllItems()` on its empty `HashSet`, and then destroys it in `~Document`. This is wasted work that scales with every detached `Document`.
Attachments
Radar WebKit Bug Importer
Comment 1 2026-05-17 20:26:36 PDT
David Kilzer (:ddkilzer)
Comment 2 2026-05-17 20:42:52 PDT
EWS
Comment 3 2026-05-17 22:25:49 PDT
Committed 313393@main (408429b44b24): <https://commits.webkit.org/313393@main> Reviewed commits have been landed. Closing PR #65083 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.