RESOLVED CONFIGURATION CHANGED 80184
Memory leak in RuleSet::addToRuleSet
https://bugs.webkit.org/show_bug.cgi?id=80184
Summary Memory leak in RuleSet::addToRuleSet
Adam Klein
Reported 2012-03-02 12:58:51 PST
Detected by the Chromium memory bots. The supposed rev range was r109464 - r109533, but I don't see anything damning in there. r105093 seems the biggest recent change to memory management in this code, thus CCing anttik and kling. Valgrind output follows: Leak_DefinitelyLost 640 bytes in 1 blocks are definitely lost in loss record 4,280 of 4,515 malloc (m_replacemalloc/vg_replace_malloc.c:1072) WTF::fastMalloc(unsigned long) (third_party/WebKit/Source/JavaScriptCore/wtf/FastMalloc.cpp:268) WTF::VectorBufferBase<WebCore::RuleData>::allocateBuffer(unsigned long) (third_party/WebKit/Source/JavaScriptCore/wtf/Vector.h:264) WTF::Vector<WebCore::RuleData, 0ul>::reserveCapacity(unsigned long) (third_party/WebKit/Source/JavaScriptCore/wtf/Vector.h:899) WTF::Vector<WebCore::RuleData, 0ul>::expandCapacity(unsigned long) (third_party/WebKit/Source/JavaScriptCore/wtf/Vector.h:816) WTF::Vector<WebCore::RuleData, 0ul>::expandCapacity(unsigned long, WebCore::RuleData const*) (third_party/WebKit/Source/JavaScriptCore/wtf/Vector.h:823) void WTF::Vector<WebCore::RuleData, 0ul>::appendSlowCase<WebCore::RuleData>(WebCore::RuleData const&) (third_party/WebKit/Source/JavaScriptCore/wtf/Vector.h:1008) WebCore::RuleSet::addToRuleSet(WTF::AtomicStringImpl*, WTF::HashMap<WTF::AtomicStringImpl*, WTF::OwnPtr<WTF::Vector<WebCore::RuleData, 0ul> >, WTF::PtrHash<WTF::AtomicStringImpl*>, WTF::HashTraits<WTF::AtomicStringImpl*>, WTF::HashTraits<WTF::OwnPtr<WTF::Vector<WebCore::RuleData, 0ul> > > >&, WebCore::RuleData const&) (third_party/WebKit/Source/JavaScriptCore/wtf/Vector.h:999) WebCore::RuleSet::addRule(WebCore::StyleRule*, WebCore::CSSSelector*, bool, bool) (third_party/WebKit/Source/WebCore/css/CSSStyleSelector.cpp:2364) WebCore::RuleSet::addStyleRule(WebCore::StyleRule*, bool, bool) (third_party/WebKit/Source/WebCore/css/CSSStyleSelector.cpp:2473) WebCore::RuleSet::addRulesFromSheet(WebCore::CSSStyleSheet*, WebCore::MediaQueryEvaluator const&, WebCore::CSSStyleSelector*, WebCore::Element const*) (third_party/WebKit/Source/WebCore/css/CSSStyleSelector.cpp:2409) WebCore::loadFullDefaultStyle() (third_party/WebKit/Source/WebCore/css/CSSStyleSelector.cpp:672) WebCore::ensureDefaultStyleSheetsForElement(WebCore::Element*) (third_party/WebKit/Source/WebCore/css/CSSStyleSelector.cpp:707) WebCore::CSSStyleSelector::styleForElement(WebCore::Element*, WebCore::RenderStyle*, bool, bool, WebCore::RenderRegion*) (third_party/WebKit/Source/WebCore/css/CSSStyleSelector.cpp:1566) WebCore::Document::styleForElementIgnoringPendingStylesheets(WebCore::Element*) (third_party/WebKit/Source/WebCore/dom/Document.cpp:1736) WebCore::Element::computedStyle(WebCore::PseudoId) (third_party/WebKit/Source/WebCore/dom/Element.cpp:1611) WebCore::HTMLTitleElement::textWithDirection() (third_party/WebKit/Source/WebCore/html/HTMLTitleElement.cpp:82) WebCore::HTMLTitleElement::childrenChanged(bool, WebCore::Node*, WebCore::Node*, int) (third_party/WebKit/Source/WebCore/html/HTMLTitleElement.cpp:61) WebCore::ContainerNode::parserAddChild(WTF::PassRefPtr<WebCore::Node>) (third_party/WebKit/Source/WebCore/dom/ContainerNode.cpp:692) WebCore::executeTask(WebCore::HTMLConstructionSiteTask&) (third_party/WebKit/Source/WebCore/html/parser/HTMLConstructionSite.cpp:95) WebCore::HTMLConstructionSite::insertTextNode(WTF::String const&, WebCore::WhitespaceMode) (third_party/WebKit/Source/WebCore/html/parser/HTMLConstructionSite.cpp:394) WebCore::HTMLTreeBuilder::processCharacterBuffer(WebCore::HTMLTreeBuilder::ExternalCharacterTokenBuffer&) (third_party/WebKit/Source/WebCore/html/parser/HTMLTreeBuilder.cpp:2395) WebCore::HTMLTreeBuilder::processCharacter(WebCore::AtomicHTMLToken&) (third_party/WebKit/Source/WebCore/html/parser/HTMLTreeBuilder.cpp:2268) WebCore::HTMLTreeBuilder::processToken(WebCore::AtomicHTMLToken&) (third_party/WebKit/Source/WebCore/html/parser/HTMLTreeBuilder.cpp:509) WebCore::HTMLTreeBuilder::constructTreeFromAtomicToken(WebCore::AtomicHTMLToken&) (third_party/WebKit/Source/WebCore/html/parser/HTMLTreeBuilder.cpp:472) WebCore::HTMLTreeBuilder::constructTreeFromToken(WebCore::HTMLToken&) (third_party/WebKit/Source/WebCore/html/parser/HTMLTreeBuilder.cpp:459) WebCore::HTMLDocumentParser::pumpTokenizer(WebCore::HTMLDocumentParser::SynchronousMode) (third_party/WebKit/Source/WebCore/html/parser/HTMLDocumentParser.cpp:278) WebCore::HTMLDocumentParser::pumpTokenizerIfPossible(WebCore::HTMLDocumentParser::SynchronousMode) (third_party/WebKit/Source/WebCore/html/parser/HTMLDocumentParser.cpp:177) WebCore::HTMLDocumentParser::append(WebCore::SegmentedString const&) (third_party/WebKit/Source/WebCore/html/parser/HTMLDocumentParser.cpp:370) WebCore::DecodedDataDocumentParser::appendBytes(WebCore::DocumentWriter*, char const*, unsigned long) (third_party/WebKit/Source/WebCore/dom/DecodedDataDocumentParser.cpp:50)
Attachments
Andreas Kling
Comment 1 2012-03-03 02:56:52 PST
This should be harmless, as it's only ever allocated once. Are you seeing multiple instances of this stack?
Alexey Proskuryakov
Comment 2 2012-03-05 11:35:07 PST
We should fix even one-time leaks, because they make hunting down more important ones with tools like leaks(1) or valgrind harder.
Ahmad Saleem
Comment 3 2022-09-30 08:37:11 PDT
(In reply to Alexey Proskuryakov from comment #2) > We should fix even one-time leaks, because they make hunting down more > important ones with tools like leaks(1) or valgrind harder. @ap - is this something needed now or we can mark this as WONTFIX? Thanks!
Alexey Proskuryakov
Comment 4 2022-09-30 13:07:37 PDT
It's hard to re-test in this exact way, but I haven't seen this leak on Mac when testing after 2012.
Note You need to log in before you can comment on or make changes to this bug.