Closed Bug 227856 Opened 22 years ago Closed 19 years ago

Gfx:Gtk (including Xft) and Gfx:Xlib need a clean-up observer to free global variables

Categories

(Core Graveyard :: GFX: Gtk, defect)

x86
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: jshin1987, Assigned: jshin1987)

Details

Attachments

(1 file)

Currently, dtors of nsFontMetricsGTK/Xlib/Xft call FreeGlobal() that clean up static global variables. This is certainly not efficient because nsFontMetrics* are created and destructed many times during the life time of Mozilla, but static global variables need not be released and recreated everytime this happens. nsFontMetricsWin uses nsIObserver and calls FreeGlobal only once when Mozilla is being shut down.
sorry for spamming. forgot to assign to myself.
Assignee: blizzard → jshin
Hmm. it's a bit embarrasing. I forgot that the number of nsFontMetrics(GTK|Xft) instances is kept and FreeGlobal() is called only when the instance counter goes to zero. Therefore, we don't have to bother to add a clean-up observer
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → INVALID
And print'ing that counter never gives zero? [there was something similar in GfxWin, but shanjian said that he saw the counter hitting zero and so he switched to the observer.]
I was worried a little bit that that might happen, but dashed it out because it looks like it should not happen (in theory). Now that you told me that had happened in nsFontMetricsWin, I have to reconsider. Perhaps, as you suggested, I have to add a debug statement, browse for a while (perhaps quite a long while) and see what happens.
Status: RESOLVED → REOPENED
Resolution: INVALID → ---
jshin: At least for gfx/src/xlib the problem described in comment #0 was never observed so I guess it is not present... and since the gfx/src/xlib code is more or less a GDK/GTK+-less clone of gfx/src/gtk the same conclusion should apply to gfx/src/gtk, too...
Quick reference: the GfxWin counter was removed in bug 74899.
rbs, thanks for the reference. Roland, thanks for the info. I'm just looking at Xlib code and realized what I forgot : Xlib code is structrually a bit different from Gtk code because the former uses nsFontMetricsXlibContext. BTW, is this taken care of? 1121 // XXX many of these statics need to be freed at shutdown time http://lxr.mozilla.org/seamonkey/source/gfx/src/xlib/nsFontMetricsXlib.cpp#1121
The instance counter never went zero in my 30 minute session with an Xft build. It seems like we're fine as it is now. (comment #5). Anyway, I'll try Gtk(X11core) just in case.
gfx/src/xlib and gfx/src/gtk have been removed on trunk. Please file a new bug if this still occurs in a recent trunk build. Thanks. http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/latest-trunk/ -> WORKSFORME
Status: REOPENED → RESOLVED
Closed: 22 years ago → 19 years ago
Resolution: --- → WORKSFORME
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: