[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Patch for this bug should be available soon



Hi

following up to myself to announce that a preliminary patch (attached) for this bug was worked out some days ago and should be soon available in a definitive version as soon as mike emmel, gtkdfb maintainer, reviews it.

The patch fixes the memory leaks that were experienced when destroying a child gdkwindow (takes care of releasing the cairo surface associated with a gdkwindow).

Experiments i did with cdebconf and various test scripts showed a huge redcution in wasted memory (100KB vs 900KB) for a set of ~10 questions asked in sequence.

Attilio
Index: gdk/directfb/gdkwindow-directfb.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/directfb/gdkwindow-directfb.c,v
retrieving revision 1.11
diff -u -r1.11 gdkwindow-directfb.c
--- gdk/directfb/gdkwindow-directfb.c	14 Sep 2006 02:56:01 -0000	1.11
+++ gdk/directfb/gdkwindow-directfb.c	22 Dec 2006 10:32:14 -0000
@@ -613,7 +613,18 @@
    		impl->window->Close(impl->window);
       	impl->window->Release(impl->window);
   }
+#if 1
+  if (impl->drawable.surface) {
+    GdkDrawableImplDirectFB *dimpl = GDK_DRAWABLE_IMPL_DIRECTFB (private->impl);
+    if(dimpl->cairo_surface) {
+      cairo_surface_destroy(dimpl->cairo_surface);
+      dimpl->cairo_surface= NULL;
+    }
+    impl->drawable.surface->Release (impl->drawable.surface);
+    impl->drawable.surface = NULL;
+  }
 
+#endif
 #if 0 /* let the finalizer kill it */
   if (!recursing && !foreign_destroy)
     {
@@ -1265,15 +1276,15 @@
 
   if (!private->input_only)
     {
-      if (impl->drawable.surface)
-        {
-          GdkDrawableImplDirectFB *dimpl;
-          dimpl    = GDK_DRAWABLE_IMPL_DIRECTFB (private->impl);
-          impl->drawable.surface->Release (impl->drawable.surface);
-          impl->drawable.surface = NULL;
-          cairo_surface_destroy(dimpl->cairo_surface);
-          dimpl->cairo_surface= NULL;
-        }
+    if (impl->drawable.surface) {
+      GdkDrawableImplDirectFB *dimpl = GDK_DRAWABLE_IMPL_DIRECTFB (private->impl);
+      if(dimpl->cairo_surface) {
+        cairo_surface_destroy(dimpl->cairo_surface);
+        dimpl->cairo_surface= NULL;
+      }
+    impl->drawable.surface->Release (impl->drawable.surface);
+    impl->drawable.surface = NULL;
+  }
 
       parent_impl = GDK_WINDOW_IMPL_DIRECTFB (GDK_WINDOW_OBJECT (private->parent)->impl);
 

Reply to: