[cairo] OS/2 backend support files

Peter Weilbacher mozilla at Weilbacher.org
Tue Aug 8 09:16:22 PDT 2006


Doodle wrote:
> Carl Worth wrote:
>> On Sun, 30 Jul 2006 13:49:17 +0200 (CEST), Doodle wrote:
>> 
>>>Here on OS/2 we use Cairo for some screen saver modules (not counting
>>>Mozilla), and those screen saver modules are loaded into memory when
>>>needed, and unloaded when not needed, while the screen saver "master"
>>>application/process is always running in the background. Imagine, if
>>>neither Cairo nor Fontconfig would be cleaned up, we'd have a nice memory
>>>leak after every screen saver module running.
>> 
>> I didn't explain this very well. If you have a long-running process
>> that occasionally loads a fontconfig-using module, and you don't call
>> FcFini when unloading each module then you will not have any memory
>> leaks, (excepting bugs of course).
> 
> Sure I will.
> 
> I guess we have a misunderstanding here. It's not that FontConfig and
> Cairo is always loaded into that process and that we sometimes also
> load and unload some other code which uses them. Cairo and FontConfig is
> only loaded and initialized when needed, and unloaded/uninitialized when
> not needed anymore. Some of the screen saver modules utilize Cairo, some
> don't. (Similarly, some of the screen saver modules use Video Overlay,
> some don't, and we don't have the Video Overlay support code loaded into
> memory and initialized all the time, only when needed...)
> 
> So, I have a long running process that occasionally loads and unloads
> Fontconfig itself (and Cairo itself) implicitly together with the saver
> module which depends on it. If I don't call FcFini() and
> cairo_debug_reset_static_data() when Cairo is uninitialized, then some
> previously malloc()'d memory won't be free'd, and those structures will
> be allocated again next time when those libraries are loaded into memory
> and initialized in the same process.
> 
> I wouldn't like to argue on this, but I did detect memory leaks every
> time those screen saver modules were unloaded, and the memory leak
> detector showed that the leaked memory areas are from FontConfig (the
> in-memory cache structure) and from Cairo (the area called "static 
> data"). Calling FcFini() and cairo_debug_reset_static_data() did resolve
> the memory leak.
> 
> To summarize it into one question:
> Do you really think that if a process _repeatedly_ loads FontConfig.DLL,
> calls FcInit(), then unloads FontConfig.DLL without calling FcFini(),
> then it won't have memory leaks?

[...]

> Okay, I've renamed them to
> cairo_os2_surface_set_manual_window_refresh();
> cairo_os2_surface_get_manual_window_refresh();
> cairo_os2_surface_refresh_window();
> 
> and moved the less-used ones to the bottom of the header file.
> Also, I've modified the documentation in the header file as
> you've suggested to have more information about the connectivity
> between these functions, and what they can be used to.

Carl,

how was that with the squeaky doors? :-)

Does the silence mean that you were convinced by what Doodle wrote a
week ago? Should I create a new OS/2 patch containing the new changes
and mail it around again?

Cheers,
   Peter.


More information about the cairo mailing list