Bug 77867 - Decrease total memory usage of CSSStyleSelector::appendAuthorStylesheets
Summary: Decrease total memory usage of CSSStyleSelector::appendAuthorStylesheets
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-06 06:02 PST by Zoltan Horvath
Modified: 2012-02-06 21:13 PST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Zoltan Horvath 2012-02-06 06:02:11 PST
CSSStyleSelector::appendAuthorStylesheets was introduced in r104060 bug #75508
I was investigating total memory usage with Freya tool (http://webkit.sed.hu/blog/20091127/new-tool-extract-meaningful-memory-consumption-values-valgrind-shines-again) and I found that calling Vector's shrinkToFit method generates a lot of memory usage. 
shrinkToFit function call of appendAuthorStylesheets is accountable for 5.6 megabytes total memory allocation while it has only 452 kbytes peak.
My question: is it necessary to call shrinkToFit in appendAuthorStylesheets? If it is then do you have any idea about a lazy-calling way?
Comment 1 Antti Koivisto 2012-02-06 21:13:17 PST
Calling shrinkToFit just moves the memory usage from one function to another. It reduces overall consumption by minimizing the wasted space in the vector. 

Based on the information given this is not a bug.