Bug 186703

Summary: CachedRawResource wastes 57K of Vector capacity
Product: WebKit Reporter: Simon Fraser (smfr) <simon.fraser>
Component: Page LoadingAssignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: beidson, cdumez, commit-queue, dbates, ews-watchlist, japhet, simon.fraser, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Simon Fraser (smfr)
Reported 2018-06-15 15:04:07 PDT
On theverge.com, tooling from bug 186698: Wasted capacity: 57584 bytes (used 4880 of 62464 bytes, utilization: 7.81%) - 13 allocations 1 0x107ee28b5 WTF::VectorBuffer<WebCore::CachedRawResource::RedirectPair, 0ul>::VectorBuffer() 2 0x107ee2895 WTF::Vector<WebCore::CachedRawResource::RedirectPair, 0ul, WTF::CrashOnOverflow, 16ul>::Vector() 3 0x107ec4b75 WTF::Vector<WebCore::CachedRawResource::RedirectPair, 0ul, WTF::CrashOnOverflow, 16ul>::Vector() 4 0x107ec4b04 WebCore::CachedRawResource::CachedRawResource(WebCore::CachedResourceRequest&&, WebCore::CachedResource::Type, PAL::SessionID) 5 0x107ec4bcb WebCore::CachedRawResource::CachedRawResource(WebCore::CachedResourceRequest&&, WebCore::CachedResource::Type, PAL::SessionID) 6 0x107ed1700 WebCore::createResource(WebCore::CachedResource::Type, WebCore::CachedResourceRequest&&, PAL::SessionID) 7 0x107ed13ca WebCore::CachedResourceLoader::loadResource(WebCore::CachedResource::Type, WebCore::CachedResourceRequest&&) 8 0x107ece32d WebCore::CachedResourceLoader::requestResource(WebCore::CachedResource::Type, WebCore::CachedResourceRequest&&, WebCore::CachedResourceLoader::ForPreload, WebCore::CachedResourceLoader::DeferOption)
Attachments
Patch (1.81 KB, patch)
2018-06-15 16:10 PDT, Chris Dumez
no flags
Radar WebKit Bug Importer
Comment 1 2018-06-15 15:04:24 PDT
Chris Dumez
Comment 2 2018-06-15 15:27:59 PDT
Vector<RedirectPair> m_redirectChain; in CachedRawResource. We never reserve capacity explicitly and only call append() on it.
Chris Dumez
Comment 3 2018-06-15 15:42:59 PDT
Looks like Vector has a default inlineCapacity of 0 but a minCapacity of 16. Note that the Vector contains ResourceResponse & ResponseRequest objects, which are large.
Chris Dumez
Comment 4 2018-06-15 16:03:22 PDT
Note that as long as the vector is empty, its capacity is 0, even though the default minCapacity is 16. However, as soon as you append one element to the Vector, capacity jumps from 0 to 16.
Chris Dumez
Comment 5 2018-06-15 16:10:26 PDT
WebKit Commit Bot
Comment 6 2018-06-15 16:54:19 PDT
Comment on attachment 342855 [details] Patch Clearing flags on attachment: 342855 Committed r232897: <https://trac.webkit.org/changeset/232897>
WebKit Commit Bot
Comment 7 2018-06-15 16:54:20 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.