GNOME Bugzilla – Bug 764089
PangoWin32FontMap Memory Leak
Last modified: 2018-05-22 13:17:13 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
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.
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.
Okay. I might have time to look at it some more.
-- 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.