Bug 17097

Summary: CGFontRefs (and HFONTs on Windows) leak because FontCache grows without bound
Product: WebKit Reporter: Adam Roben (:aroben) <aroben>
Component: TextAssignee: mitz
Status: RESOLVED FIXED    
Severity: Normal CC: eric, hyatt, mitz
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   

Adam Roben (:aroben)
Reported 2008-01-30 11:38:02 PST
The FontCache currently grows without bound, which means we're leaking the CGFontRefs and HFONTs used to construct the FontPlatformData objects held by the cache.
Attachments
Adam Roben (:aroben)
Comment 1 2008-01-30 11:39:03 PST
Some quotes from Hyatt on this issue: <dhyatt> it's not obvious how to change it without hurting perf <dhyatt> the tentative idea i had was to refcount FontDatas <dhyatt> and just pretend like FontPlatformData is always a "temporary" <dhyatt> to avoid massive refcount churn on the fontplatformdata <dhyatt> if you look at fontdata's destructor <dhyatt> (i guess simplefontdata now) <dhyatt> it does actually have code to delete the HFONT and release the cgfontref <dhyatt> it never gets called <dhyatt> i just mean i wrote the code assuming that someday the fontdatas would get destroyed <dhyatt> purged from the cache etc
Adam Roben (:aroben)
Comment 2 2008-01-30 11:39:44 PST
mitz
Comment 3 2008-04-01 19:25:00 PDT
*** Bug 18263 has been marked as a duplicate of this bug. ***
Eric Seidel (no email)
Comment 4 2008-04-01 22:35:52 PDT
This doesn't matter much on OS X (I don't think). But on Windows, there are only 65k GDI Object Handles per user session. These handle "leaks" can end up causing Safari to take up an unfair number of handles.
mitz
Comment 5 2008-04-01 23:04:31 PDT
The HFONTs are now owned by the FontPlatformData (not the SimpleFontData). One possible solution would be to have a way to invalidate those and make the SimpleFontData check the validity before any other accees. You'll also need a way to regenerate the FontPlatformData if they were invalidated (you need a FontDescription and a family name for that IIRC).
mitz
Comment 6 2008-05-12 14:07:47 PDT
mitz
Comment 7 2008-05-31 00:57:39 PDT
The bug is not fixed in TOT. PlatformFontData objects which hold on to HFONTs and CGFontRefs are still held indefinitely by the FontPlatformDataCache.
mitz
Comment 8 2008-07-25 12:12:11 PDT
Note You need to log in before you can comment on or make changes to this bug.