[cp-patches] Re: RFC: Cairo memory leak fixes

Mark Wielaard mark at klomp.org
Thu Jun 8 11:08:50 UTC 2006

Hi Sven,

On Wed, 2006-06-07 at 01:31 +0200, Sven de Marothy wrote:
> On Tue, 2006-06-06 at 17:40 +0200, Mark Wielaard wrote:
> > This fixes some memory leaks found by Norman when trying niffler with
> > the new Cairo code. With this I am able to run the slideshow without
> > running out of memory.
> Looks good to me. I know I left some leaks here and there. So cleaning
> them up just means less work for me to do. Yay. :)

Good. But if you happen to have a list of things that need cleaning up
that would be appreciated. Hunting down memory leaks in the C code isn't
that fun to be honest.

I found another small one where we weren't unreffing a gdkpixbuf loader
which was holding onto the gdkpixbuf for us that we did unload. But we
were keeping the loader itself around. This fixes that:

2006-06-08  Mark Wielaard  <mark at klomp.org>

    PR 27917
    * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c
    (Java_gnu_java_awt_peer_gtk_GtkImage_loadImageFromData): Ref pixbuf
    and unref loader.



--- native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c        30 May 2006 11:30:02 -0000      1.23
+++ native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c        8 Jun 2006 11:07:28 -0000
@@ -117,10 +117,14 @@

   if (pixbuf == NULL)
+      g_object_unref (loader);
       createRawData (env, obj, NULL);
       return JNI_FALSE;

+  g_object_ref (pixbuf);
+  g_object_unref (loader);
   width =  gdk_pixbuf_get_width (pixbuf);
   height = gdk_pixbuf_get_height (pixbuf);

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://developer.classpath.org/pipermail/classpath-patches/attachments/20060608/fff82a52/attachment-0001.pgp

More information about the Classpath-patches mailing list