GNOME Bugzilla – Bug 663543
Huge memory leak while using MS-Windows theme (gtk-demo)
Last modified: 2011-11-10 10:51:02 UTC
I've detected a (huge) memory leak when using the MS-Windows theme which is the default one on a windows installation. I observed that at least in GTK+ 2.16 and 2.22 It is very simple to reproduce: gtk-demo application on Windows XP / 7 (32 an 64 bit). Just start the "Paned Widgets" sample and drag the handles for a while. The memory consumption increases very fast. The leak is not visible when using metal, emacs or other themes. My feeling is that the issue is also existent when resizing the whole window for a while (although not as clearly visible as dragging the handle of the Paned). Unfortunately the leak is also existent when refreshing widgets inside a Paned-Widget (i.e. Label::set_text )
The MS-Windows theme is part of the GTK+ distribution. Reassigning.
Created attachment 200968 [details] [review] win32: plug leak when drawing handles gdk_cairo_create is always being called in draw_handle (see modules/engines/ms-windows/msw_style.c:3271) but the context is only ever used and destroyed(!) in the second if block, when "(!GTK_IS_PANED (widget))". So, moving the gdk_cairo_create call inside that second if block would be the obvious fix. However, draw_handle (and gtk_paint_handle, which in itself calls the active style's draw_handle) is only ever called by gtkhandlebox and gtkpaned. Which sorta makes that whole second if block pointless as: - the first if block draws handles for GtkHandleBox - the second if block does *not* draw handles for GtkPaned So, looks like we can safely remove the gdk_cairo_create call and the whole second if block from draw_handle. Proposed patch does exactly that.
http://git.gnome.org/browse/gtk+/commit/?h=gtk-2-24&id=d8c2db333521063b6cce5355b749e40bd6c011f4 This problem has been fixed in our software repository. The fix will go into the next software release. Thank you for your bug report.
Thank you for your fast reaction. It works fine.