Bug 57478 - REGRESSION (r82400): Leaks seen beneath CSSParser::createFloatingVectorSelector when parsing UA stylesheet
Summary: REGRESSION (r82400): Leaks seen beneath CSSParser::createFloatingVectorSelect...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Ojan Vafai
URL:
Keywords: InRadar, Regression
Depends on:
Blocks:
 
Reported: 2011-03-30 11:01 PDT by Adam Roben (:aroben)
Modified: 2011-03-31 06:10 PDT (History)
7 users (show)

See Also:


Attachments
Patch (3.25 KB, patch)
2011-03-30 21:51 PDT, Ojan Vafai
aroben: review+
aroben: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Roben (:aroben) 2011-03-30 11:01:43 PDT
To see the leaks:

1. Go to <http://build.webkit.org/LeaksViewer/?url=http://build.webkit.org/results/SnowLeopard%20Intel%20Leaks/r82400%20(15899)/>
2. Dig into malloc_zone_malloc > malloc -> WTF::fastMalloc

The first leak listed here is an allocation inside Vector. If you look a little lower down you'll see the Vector itself is leaking (as indicated by the Vector<OwnPtr<CSSParserSelector> >::operator new leak).

Other evidence:

r82398, 2439 leaks:
http://build.webkit.org/builders/SnowLeopard%20Intel%20Leaks/builds/15898

r82400, 3186 leaks:
http://build.webkit.org/builders/SnowLeopard%20Intel%20Leaks/builds/15899
Comment 1 Adam Roben (:aroben) 2011-03-30 11:02:03 PDT
r82400 added uses of :-webkit-any to the UA stylesheet, so my guess is that the :-webkit-any implementation is leaky.
Comment 2 Adam Roben (:aroben) 2011-03-30 11:04:26 PDT
<rdar://problem/9209334>
Comment 3 Yuta Kitamura 2011-03-30 19:34:43 PDT
The same leaks are observed in Chromium, too.
<http://code.google.com/p/chromium/issues/detail?id=77885>
Comment 4 Ojan Vafai 2011-03-30 21:51:09 PDT
Created attachment 87665 [details]
Patch
Comment 5 Adam Roben (:aroben) 2011-03-30 22:01:55 PDT
Comment on attachment 87665 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=87665&action=review

> Source/WebCore/css/CSSGrammar.y:1152
> +            OwnPtr<Vector<OwnPtr<CSSParserSelector> > > selectorVector = p->sinkFloatingSelectorVector($4);
> +            $$->adoptSelectorVector(*selectorVector.get());

No need for the local variable, or the .get().

> Source/WebCore/css/CSSParser.h:188
>          Vector<OwnPtr<CSSParserSelector> >* createFloatingSelectorVector();

Seems like we should change createFloatingSelectorVector to return a PassOwnPtr at some point.
Comment 6 Ojan Vafai 2011-03-30 22:13:45 PDT
(In reply to comment #5)
> (From update of attachment 87665 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=87665&action=review
> > Source/WebCore/css/CSSParser.h:188
> >          Vector<OwnPtr<CSSParserSelector> >* createFloatingSelectorVector();
> 
> Seems like we should change createFloatingSelectorVector to return a PassOwnPtr at some point.

Maybe. I was just cargo culting createFloatingSelector. :)
Comment 7 Ojan Vafai 2011-03-30 22:17:52 PDT
Committed r82545: <http://trac.webkit.org/changeset/82545>
Comment 8 WebKit Review Bot 2011-03-30 23:04:18 PDT
http://trac.webkit.org/changeset/82545 might have broken GTK Linux 32-bit Debug
Comment 9 Ojan Vafai 2011-03-30 23:08:15 PDT
(In reply to comment #8)
> http://trac.webkit.org/changeset/82545 might have broken GTK Linux 32-bit Debug

Looks like a false positive. This bot hasn't successfully run the tests in hours.
Comment 11 Adam Roben (:aroben) 2011-03-31 06:10:50 PDT
And Leaks Viewer says the leaks are gone, too.