After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 764089 - PangoWin32FontMap Memory Leak
PangoWin32FontMap Memory Leak
Status: RESOLVED OBSOLETE
Product: pango
Classification: Platform
Component: win32
1.39.x
Other Windows
: Normal normal
: ---
Assigned To: gtk-win32 maintainers
pango-maint
Depends on:
Blocks:
 
 
Reported: 2016-03-23 16:34 UTC by Geoffrey Yerem
Modified: 2018-05-22 13:17 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
PangoWin32FontMap Memory Leak Patch (3.46 KB, patch)
2016-03-23 16:34 UTC, Geoffrey Yerem
none Details | Review

Description Geoffrey Yerem 2016-03-23 16:34:48 UTC
Created attachment 324600 [details] [review]
PangoWin32FontMap Memory Leak Patch

Hi,
The finalize method for PangoWin32FontMap isn't reclaiming the families and fonts hash tables which results in a rather large memory leak.  Even though the font map is cached per thread, this can be a problem if you have many short lived threads.  In my case, I had a lot of worker threads which leaked memory every time they exited.  The computer's memory was exhausted in minutes.

Freeing the hash tables isn't enough though because the _PangoWin32Face and _PangoWin32Family structures don't reclaim memory at all.

I've attached a tentative patch that takes care of a lot of it, but I couldn't resolve a couple of things.  I couldn't track down the ownership of the cmap and the cached_fonts objects in _PangoWin32Face.

Also, I wanted to mention that I was trying out pangowin32 since it minimizes library dependencies.  It sounds like it would be good to maintain it.

Thanks!

Geoffrey
Comment 1 LRN 2016-03-25 15:25:47 UTC
I'm adding behdad to CC, in case he wasn't watching the appropriate bug sink.
He's the one who did most w32-related hacking on Pango for the last few years. Before him the only widely-contributing-to-w32-code author was tml - and that should tell you just how *ancient* w32 Pango code is.
Comment 2 Behdad Esfahbod 2016-03-26 16:37:58 UTC
Thanks for the patch.  The cmap situation is not easy to fix.  It currently doesn't have lifecycle management.  The cached_fonts should be easier to figure out.  I'm committing what you have provided so far.  Please send more if you figure out.  Thanks.
Comment 3 Geoffrey Yerem 2016-03-26 19:44:43 UTC
Okay.  I might have time to look at it some more.
Comment 4 GNOME Infrastructure Team 2018-05-22 13:17:13 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/pango/issues/253.