There is a very obvious leak here. StyledElementInlineStylePropertyMap ref's its element and Element Ref's the map in ElementRareData. <rdar://problem/47254121>
Created attachment 365308 [details] Fixes the bug
Created attachment 365309 [details] Updated the change log
Comment on attachment 365309 [details] Updated the change log View in context: https://bugs.webkit.org/attachment.cgi?id=365309&action=review > Source/WebCore/dom/Element.cpp:209 > + if (auto* map = elementRareData()->attributeStyleMap()) > + map->clearElement(); Maybe ElementRareData should have a clearElement or clearNdoe function on it
(In reply to Simon Fraser (smfr) from comment #3) > Comment on attachment 365309 [details] > Updated the change log > > View in context: > https://bugs.webkit.org/attachment.cgi?id=365309&action=review > > > Source/WebCore/dom/Element.cpp:209 > > + if (auto* map = elementRareData()->attributeStyleMap()) > > + map->clearElement(); > > Maybe ElementRareData should have a clearElement or clearNdoe function on it That approach makes sense as well. Although I'm hoping that I can just add the support for WeakPtr<Element> and remove this code.
Committed r243239: <https://trac.webkit.org/changeset/243239>