After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 663543 - Huge memory leak while using MS-Windows theme (gtk-demo)
Huge memory leak while using MS-Windows theme (gtk-demo)
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: Win32
unspecified
Other Windows
: Normal normal
: ---
Assigned To: gtk-win32 maintainers
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2011-11-07 09:52 UTC by Christian Kliche
Modified: 2011-11-10 10:51 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
win32: plug leak when drawing handles (4.38 KB, patch)
2011-11-08 10:02 UTC, Dieter Verfaillie
committed Details | Review

Description Christian Kliche 2011-11-07 09:52:58 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 )
Comment 1 Benjamin Berg 2011-11-07 10:22:37 UTC
The MS-Windows theme is part of the GTK+ distribution. Reassigning.
Comment 2 Dieter Verfaillie 2011-11-08 10:02:33 UTC
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.
Comment 3 Dieter Verfaillie 2011-11-09 20:19:24 UTC
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.
Comment 4 Christian Kliche 2011-11-10 10:51:02 UTC
Thank you for your fast reaction. It works fine.