Closed
Bug 641663
Opened 14 years ago
Closed 14 years ago
Hidden memory costs of strings in nsCacheEntry instances
Categories
(Core :: Networking: Cache, defect)
Core
Networking: Cache
Tracking
()
RESOLVED
FIXED
Tracking | Status | |
---|---|---|
fennec | 2.0next+ | --- |
People
(Reporter: azakai, Assigned: azakai)
References
Details
Attachments
(1 file)
(deleted),
patch
|
Biesinger
:
review+
|
Details | Diff | Splinter Review |
nsCacheEntry reports its Size as mDataSize + mMetaData.Size(). However, it also holds a pointer to an nsCString (mKey) which it keeps alive. When testing on popular websites like google.com, you often see mKey be 300-400 bytes in length. As a result, in many cases the size of mKey is of the order of what nsCacheEntry reports as its size.
In other words, there is a potentially significant amount of memory that is used but not reported to about:cache, and not taken into consideration for how many entries to keep in the cache (but this isn't technically a leak). In a simple benchmark (see 'test page' attachment in bug 634642, run over hundreds of page loads), it looks like mKey is an additional 20% over the reported size of nsCacheEntry.
Assignee | ||
Comment 1•14 years ago
|
||
Patch makes nsCacheEntry::Size() take into account the length of mKey, so it more accurately represents how much memory the nsCacheEntry uses.
Assignee | ||
Updated•14 years ago
|
Assignee: nobody → azakai
Assignee | ||
Comment 2•14 years ago
|
||
Comment on attachment 519252 [details] [diff] [review]
patch
Looks good on try.
biesi, can you please take a look (or tell me who I should ask, I'm not sure who reviews netwerk/cache stuff)?
Attachment #519252 -
Flags: review?(cbiesinger)
Assignee | ||
Comment 3•14 years ago
|
||
Requesting blocking-fennec since this can save 1MB of memory in some cases (we allow 1MB for memory cache, and the amount of memory actually used can be twice as much due to these strings).
tracking-fennec: --- → ?
Updated•14 years ago
|
tracking-fennec: 2.0- → 2.0next+
Comment 5•14 years ago
|
||
Comment on attachment 519252 [details] [diff] [review]
patch
Yeah, cache patches get reviewed by me or one of the other necko peers
Attachment #519252 -
Flags: review?(cbiesinger) → review+
Assignee | ||
Comment 6•14 years ago
|
||
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•