Bug 34864 - Many objects left uncollected after visiting mail.google.com and closing window
Summary: Many objects left uncollected after visiting mail.google.com and closing window
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Other OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-02-11 15:54 PST by Geoffrey Garen
Modified: 2010-02-11 21:02 PST (History)
0 users

See Also:


Attachments
Patch (6.55 KB, patch)
2010-02-11 15:54 PST, Geoffrey Garen
ggaren: review+
Details | Formatted Diff | Diff
Patch (3.16 KB, patch)
2010-02-11 20:36 PST, Geoffrey Garen
oliver: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Geoffrey Garen 2010-02-11 15:54:13 PST
Many objects left uncollected after visiting mail.google.com and closing window
Comment 1 Geoffrey Garen 2010-02-11 15:54:28 PST
Created attachment 48594 [details]
Patch
Comment 2 Geoffrey Garen 2010-02-11 18:51:47 PST
Committed r54696: <http://trac.webkit.org/changeset/54696>
Comment 3 Geoffrey Garen 2010-02-11 20:36:12 PST
Created attachment 48619 [details]
Patch
Comment 4 Geoffrey Garen 2010-02-11 20:38:21 PST
Reopening to post the second half of this fix.
Comment 5 Oliver Hunt 2010-02-11 20:40:49 PST
Comment on attachment 48619 [details]
Patch

r=me
Comment 6 Darin Adler 2010-02-11 20:42:05 PST
Comment on attachment 48619 [details]
Patch

> +        Don't unconditionally hang onto small strings. Instead, hang onto all
> +        small strings as long as any small string is still referenced.

What is the reasoning for that rule? I'm sure it's a good idea, but I think SmallStrings::markChildren should have a "why" comment in it explaining why it is.

> +        if (isMarked(m_singleCharacterStrings[i]))
> +            isAnyStringMarked = true;

I suggest just doing assignment here instead of an if statement to save a branch.
Comment 7 Geoffrey Garen 2010-02-11 21:01:14 PST
Committed r54701: <http://trac.webkit.org/changeset/54701>
Comment 8 Geoffrey Garen 2010-02-11 21:02:50 PST
> What is the reasoning for that rule? I'm sure it's a good idea, but I think
> SmallStrings::markChildren should have a "why" comment in it explaining why it
> is.

Added this comment:

    /*
       Our hypothesis is that small strings are very common. So, we cache them
       to avoid GC churn. However, in cases where this hypothesis turns out to
       be false -- including the degenerate case where all JavaScript execution
       has terminated -- we don't want to waste memory.

       To test our hypothesis, we check if any small string has been marked. If
       so, it's probably reasonable to mark the rest. If not, we clear the cache.
     */

> > +        if (isMarked(m_singleCharacterStrings[i]))
> > +            isAnyStringMarked = true;
> 
> I suggest just doing assignment here instead of an if statement to save a
> branch.

Fixed.