Closed
Bug 1268951
Opened 9 years ago
Closed 9 years ago
Downloaded font resources take up excessive memory
Categories
(Core :: Graphics: Text, defect)
Core
Graphics: Text
Tracking
()
RESOLVED
FIXED
mozilla49
Tracking | Status | |
---|---|---|
firefox49 | --- | fixed |
People
(Reporter: jfkthame, Assigned: jfkthame)
Details
Attachments
(1 file, 1 obsolete file)
When we download, decode and sanitize @font-face resources, we generally end up with quite a bit of over-allocation. The OTS decoder/sanitizer cannot know in advance how large the final font data will be, so it uses an ExpandingMemoryStream which grows by leaps and bounds... so for example, each of the Fira fonts used on b.m.o ends up with a sanitized data block that has around 100K or so of unused space.
So we can reduce the persistent RAM requirements of downloaded fonts by reallocating the data to a properly-sized block, and get rid of the clownshoes.
Assignee | ||
Comment 1•9 years ago
|
||
Seems worth trimming the clownshoes here. With a few font-heavy sites loaded, the total slop can fairly easily run into megabytes.
Attachment #8747194 -
Flags: review?(jmuizelaar)
Assignee | ||
Updated•9 years ago
|
Assignee: nobody → jfkthame
Status: NEW → ASSIGNED
Comment 2•9 years ago
|
||
Comment on attachment 8747194 [details] [diff] [review]
Reallocate sanitized user font data into an appropriately-sized block, to reduce ongoing RAM footprint
Review of attachment 8747194 [details] [diff] [review]:
-----------------------------------------------------------------
::: gfx/thebes/gfxUserFontSet.cpp
@@ +266,1 @@
> }
It seems like this would be better as a method ExpandingMemoryStream. Something like ShrinkToLength() perhaps.
Attachment #8747194 -
Flags: review?(jmuizelaar) → review-
Assignee | ||
Comment 3•9 years ago
|
||
OK, here's an option I was considering: encapsulate the shrink-to-fit within the .forget() method. This is the only place where the ExpandingMemoryStream's buffer gets exposed to the outside world, so we can simply fix it up here and the client code needn't care what was going on internally while the stream was being written.
Attachment #8747301 -
Flags: review?(jmuizelaar)
Assignee | ||
Updated•9 years ago
|
Attachment #8747194 -
Attachment is obsolete: true
Updated•9 years ago
|
Attachment #8747301 -
Flags: review?(jmuizelaar) → review+
Comment 5•9 years ago
|
||
bugherder |
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
status-firefox49:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla49
You need to log in
before you can comment on or make changes to this bug.
Description
•