[Pixman] [BUG REPORT] pixman_glyph_cache_create leaks memory that it allocates

Yuri yuri at rawbw.com
Sun Sep 17 16:46:50 UTC 2017


On 09/17/17 06:10, Siarhei Siamashka wrote:
> Can Yuri tell us more about his dynamic load/reload use case? So far
> I'm not aware of anyone doing this in practice.

I instantiate LV2 (audio) plugin UIs, which are mostly gtk in the 
non-gtk app. I dynamically load libgtkmm/libglib libraries in order to 
show the UI, then I unload them. This is done with dlopen/dlsym/dlclose.


> Maybe the right solution is to add explicit pixman_init() and
> pixman_destroy() functions. But we need to support existing
> applications too and we can't expect them to start using these
> new functions without enforcing some changes. That's a kind of
> historical baggage, and nobody feels like opening this can of
> worms.


You can't rely on the apps to always call the right functions. Instead, 
the correct behavior is to uninitialize on exit. What you need to do is 
to schedule uninitialization with atexit call. 
(https://linux.die.net/man/3/atexit)

The behavior should be the same as when there is a static C++ object 
with destructor. Such destructor will always be called via atexit, 
either at the end of the application, or when the shared library is 
unloaded.


Yuri



More information about the Pixman mailing list