Re: Memory leak when drawing with pangomm/cairomm (MSYS2)
Kjell Ahlstedt via gtkmm-list <[email protected]> Fri, 25 Jun 2021 09:26:07 +0200
| Newsgroups | gmane.comp.gnome.gtkmm |
|---|---|
| Message-ID | <[email protected]> |
Den 2021-06-22 kl. 13:38, skrev 廖骏轩 via gtkmm-list: > I have just found out that the Windows version of my project has a massive memory leak, while on Linux it seems alright. It uses pangomm and cairomm to display text, and I believe it’s similar to the examples in the online book, “Programming with gtkmm4”. queue_draw() is called every 100 ms, and in a few minutes, the memory usage would reach several GB. If I don’t call queue_draw(), the memory used stays around 100 MB. > Does anyone know what caused the memory leak? Thanks! I don't know what caused the memory leak, but I'd like to give you a few suggestions for trouble-shooting. The C++ bindings (gtkmm, pangomm, etc.) have no or extremely little code that's not identical on Windows and Linux. In the first place, suspect one of the underlying C modules (gtk, pango, etc.). Do you know if there's a similar memory leak with gtkmm3? If there's no memory leak with gtkmm3, suspect gtk4. Remove more and more of the code, possibly until there's nothing left to draw for queue_draw(). If the memory leak disappears at some step, you may have found the function that leaks memory. Is valgrind or a similar memory analyzer available on Windows? If so, it can probably tell you who allocates a huge amount of memory. _______________________________________________ gtkmm-list mailing list [email protected] https://mail.gnome.org/mailman/listinfo/gtkmm-list