PangoWin32FontMap Memory Leak
Submitted by Geoffrey Yerem
Created attachment 324600 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.
Patch 324600, "PangoWin32FontMap Memory Leak Patch":