Hi Francis,

On Mon, 2007-04-09 at 17:34 -0400, Francis Kung wrote:
> Rather than re-ordering the 
> dispose calls, this patch destroys the surface immediately after it's 
> used the initialize the cairo context (the cairo context will keep its 
> own reference to the surface).
> 
> One of the rather nasty symptoms of this memory leak was a hanging X 
> server once the application is exited.
> 
> Any chance for this to get in the upcoming release too? =)

Wow, yes applied to the release branch. You are right without this patch
you could completely hang a system. I also made the same change for
VolatileImageGraphics:

2007-04-10  Mark Wielaard  <[EMAIL PROTECTED]>

    * native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphics.c
    (Java_gnu_java_awt_peer_gtk_ComponentGraphics_initFromVolatile):
    Destroy surface after it is used to create a cairo context.

The other memory issue I was seeing with jedit doesn't seem to be a
memory leak. we just need more than the default 32M that jedit uses by
default. Giving it more memory makes it work just fine.

There is a memory leak when rotated text is used a lot (you can see it
in the classpath examples Swing Demo with the ProgressBar). We keep
allocating new FontPeers because the caching logic in
GtkToolkitget.ClasspathFontPeer() cannot see when TransformAttributes
are equal (since TransformAttribute doesn't implement equals() and
hashCode()). And FontPeer calls pango_context_load_fontset () which
seems to leak memory even though we seem to try to g_object_unref () it.

Cheers,

Mark

diff -u -r1.19 gnu_java_awt_peer_gtk_ComponentGraphics.c
--- native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphics.c       9 Apr 
2007 21:34:27 -0000       1.19
+++ native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphics.c       10 Apr 
2007 10:46:41 -0000
@@ -1,5 +1,5 @@
 /* gnu_java_awt_peer_gtk_ComponentGraphics.c
-   Copyright (C) 2006 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2007 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -197,6 +197,7 @@
 
   cr = cairo_create (surface);
   g_assert(cr != NULL);
+  cairo_surface_destroy(surface);
 
   gdk_threads_leave();
 

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to