Closed
Bug 1485712
Opened 7 years ago
Closed 7 years ago
SkTypeface memory leak in ScaledFonts with P-OMTP
Categories
(Core :: Graphics, defect, P1)
Core
Graphics
Tracking
()
RESOLVED
FIXED
mozilla63
Tracking | Status | |
---|---|---|
firefox-esr52 | --- | unaffected |
firefox-esr60 | --- | unaffected |
firefox61 | --- | unaffected |
firefox62 | --- | unaffected |
firefox63 | --- | fixed |
People
(Reporter: lsalzman, Assigned: lsalzman)
References
Details
(Keywords: memory-leak, regression, Whiteboard: [gfx-noted])
Attachments
(1 file)
12.47 KB,
patch
|
rhunt
:
review+
|
Details | Diff | Splinter Review |
There is a race condition in ScaledFont::GetSkTypeface when multiple threads try to call GetSkTypeface at the same time. This bug unfortunately affects all platforms, not just Linux.
To work around this, I have made mTypeface an atomic pointer, and we use a compare-and-swap with null to verify we're actually the first one initializing this pointer. In the event that a thread loses, it just derefs/deallocates the typeface and all is well.
This strategy is lock-free and will avoid any extra locks/blocking so we shouldn't see added overhead from it when we go to render text.
I've restructured the code a bit to move the details of the atomic initialization into ScaledFontBase, so that each ScaledFont implementation does not have to reproduce it.
Attachment #9003502 -
Flags: review?(rhunt)
Assignee | ||
Updated•7 years ago
|
Summary: SkTypeface memory eak in ScaledFonts with P-OMTP → SkTypeface memory leak in ScaledFonts with P-OMTP
Comment 1•7 years ago
|
||
Comment on attachment 9003502 [details] [diff] [review]
set SkTypeface atomically in ScaledFonts
Review of attachment 9003502 [details] [diff] [review]:
-----------------------------------------------------------------
Nice catch.
Attachment #9003502 -
Flags: review?(rhunt) → review+
Pushed by lsalzman@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/582994eb6fa9
set SkTypeface atomically in ScaledFonts. r=rhunt
Comment 3•7 years ago
|
||
bugherder |
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
status-firefox63:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
Updated•7 years ago
|
status-firefox61:
--- → unaffected
status-firefox62:
--- → unaffected
status-firefox-esr52:
--- → unaffected
status-firefox-esr60:
--- → unaffected
Updated•7 years ago
|
Keywords: regression
You need to log in
before you can comment on or make changes to this bug.
Description
•