Bug 80184
Summary: | Memory leak in RuleSet::addToRuleSet | ||
---|---|---|---|
Product: | WebKit | Reporter: | Adam Klein <adamk> |
Component: | CSS | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED CONFIGURATION CHANGED | ||
Severity: | Normal | CC: | ahmad.saleem792, ap, kling, koivisto, nima.ghanavatian, shezbaig.wk, thakis, tonikitoo |
Priority: | P2 | ||
Version: | 528+ (Nightly build) | ||
Hardware: | Unspecified | ||
OS: | Unspecified |
Adam Klein
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 | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Andreas Kling
This should be harmless, as it's only ever allocated once. Are you seeing multiple instances of this stack?
Alexey Proskuryakov
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
(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
It's hard to re-test in this exact way, but I haven't seen this leak on Mac when testing after 2012.