Re: Memory leak when drawing with pangomm/cairomm (MSYS2)
Thanks for your suggestions! I have already tried removing some of the code, and the memory leak persists even if there’s nothing to draw. But it may be other problems elsewhere, so I will try to construct a minimum project later and try other things if I have the time. By the way, there’s no valgrind on Windows, and I will first try without such tools as I don’t frequently use Windows. > 在 2021年6月25日,下午3:26,Kjell Ahlstedt 写道: > > 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
Re: Memory leak when drawing with pangomm/cairomm (MSYS2)
Yeah, it's probably a C lib, and ASan or Val/MemGrind should be able to identify leaks pretty well. ___ gtkmm-list mailing list [email protected] https://mail.gnome.org/mailman/listinfo/gtkmm-list
Re: Memory leak when drawing with pangomm/cairomm (MSYS2)
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
