Bug 167838 - Fix memory issues related to preload eviction.
Summary: Fix memory issues related to preload eviction.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-02-04 11:52 PST by Yoav Weiss
Modified: 2017-02-04 13:42 PST (History)
5 users (show)

See Also:


Attachments
Patch (2.16 KB, patch)
2017-02-04 11:55 PST, Yoav Weiss
no flags Details | Formatted Diff | Diff
Patch (2.31 KB, patch)
2017-02-04 12:00 PST, Yoav Weiss
no flags Details | Formatted Diff | Diff
Patch (2.32 KB, patch)
2017-02-04 12:56 PST, Yoav Weiss
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yoav Weiss 2017-02-04 11:52:03 PST
Fix memory issues related to preload eviction.
Comment 1 Yoav Weiss 2017-02-04 11:55:30 PST
Created attachment 300633 [details]
Patch
Comment 2 Yoav Weiss 2017-02-04 12:00:15 PST
Created attachment 300634 [details]
Patch
Comment 3 Andreas Kling 2017-02-04 12:47:38 PST
Comment on attachment 300634 [details]
Patch

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

r=me, thanks for the quick turnaround :)

> Source/WebCore/loader/cache/CachedResourceLoader.cpp:1274
> +    if (linkPreloads && linkPreloads->size())
> +        m_preloads = WTFMove(linkPreloads);
> +    else
>          m_preloads = nullptr;

I think linkPreloads->size() is guaranteed to be >= 1 here, since you only allocate it when actually adding something.
I would suggest renaming it to remainingLinkPreloads, and then replacing this block with simply:
m_preloads = WTFMove(remainingLinkPreloads);
Comment 4 Yoav Weiss 2017-02-04 12:56:25 PST
Created attachment 300637 [details]
Patch
Comment 5 Yoav Weiss 2017-02-04 13:04:24 PST
(In reply to comment #3)
> Comment on attachment 300634 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=300634&action=review
> 
> r=me, thanks for the quick turnaround :)
> 
> > Source/WebCore/loader/cache/CachedResourceLoader.cpp:1274
> > +    if (linkPreloads && linkPreloads->size())
> > +        m_preloads = WTFMove(linkPreloads);
> > +    else
> >          m_preloads = nullptr;
> 
> I think linkPreloads->size() is guaranteed to be >= 1 here, since you only
> allocate it when actually adding something.
> I would suggest renaming it to remainingLinkPreloads, and then replacing
> this block with simply:
> m_preloads = WTFMove(remainingLinkPreloads);

Good call. Changed as suggested
Comment 6 WebKit Commit Bot 2017-02-04 13:42:01 PST
Comment on attachment 300637 [details]
Patch

Clearing flags on attachment: 300637

Committed r211673: <http://trac.webkit.org/changeset/211673>
Comment 7 WebKit Commit Bot 2017-02-04 13:42:06 PST
All reviewed patches have been landed.  Closing bug.