GNOME Bugzilla – Bug 679312
Memory leak regression from 2.16.6 (g_idle_add() or queue_draw())
Last modified: 2012-10-17 08:16:04 UTC
Created attachment 217917 [details] A minimal example that triggers the leak. We have found a regression that block us to migrate our existing WIN32 GTK based apps from GTK 2.16.6 (gtk.org bundle 20100207) to GTK 2.24.10 (gtk.org bundle 20120208), it seems there is a memory leak in g_idle_add() use or something related to queue_draw(), anyway the attached code (that I think is correct) do not leak in linux (ubuntu 12.04, gtk 2.24.10) nor on win32 (GTK 2.16.6) while it leaks about 12kbyte/sec with GTK 2.24.10 on win32 (it can be easily observed with win32 task manager, the program will make your machine unusable after a few hours). I can confirm the leak in windows XP and in windows 7, I've not tried with vista. I've had confirmation also in the gtk-app-dev mailing list that I can use g_idle_add to notify when a new frame is available without freeing the source, that works in linux and in older WIN32 versions and it seems the way to go also in the g_idle_add() documentation that says: If the function returns FALSE it is automatically removed from the list of event sources and will not be called again. The (real) code is a video player with multiple realtime streams, this code use g_timeout_add() to simulate the 25fps of the video, I fill the drawing area with a simple red/blue pattern without thinking to much to endianness of the pixel components, but this is a sample, the code leaks on win32/2.24.10 also if I do not draw *ANYTHING* inside the GdkImage...
Other users have the same problem: http://stackoverflow.com/questions/10837776/memory-leak-in-gtk-under-windows-7-in-gtk-widget-queue-draw http://www.developpez.net/forums/d1270483/general-developpement/programmation-systeme/linux/gtk/gtkp/memory-leak-gtk/ The example code on http://pastebin.com/DY4WVvth is shorter that the one provided here and shows the problem. As there are several people complaining, I think the bug should be confirmed. Is there anyone maintaining GTK on Windows these days, since Tor stepped back?
Might also be the root cause there: http://www.digipedia.pl/usenet/thread/1097/28214/
Seems it's a duplicate of bug 685959. *** This bug has been marked as a duplicate of bug 685959 ***