Re: [PATCH] Re: Gtk2::Gdk::Pixbuf::render_pixmap_and_mask leaks X memory ?



On Sun, 2007-04-29 at 22:17 -0400, muppet wrote:
On Apr 21, 2007, at 7:37 PM, squentin wrote:

It seems the render_pixmap_and_mask function from Gtk2::Gdk::Pixbuf is
leaking. Repetitive call to it cause the X server memory usage to  
grow.
Am I missing something ?

No, you're not.  That appears to be a resource leak because of a  
reference leak in the bindings.  gdk_pixbuf_render_pixmap_and_mask()  
and gdk_pixbuf_render_pixmap_and_mask_for_colormap() return brand-new  
GdkDrawables, but the bindings do not take ownership of the new  
objects.  The GObjects leak, so the underlying X resources leak.

Please try the attached patch.

Thanks for the patch, but it doesn't seem to work, X memory still grows.
You can easily test it with this small script. Replace file.jpg with a
real file, and watch X memory grows with "top", don't let it grow too
much ...

#!/usr/bin/perl
use strict;
use warnings;

use Gtk2 "-init";

my $pb=Gtk2::Gdk::Pixbuf->new_from_file("file.jpg");
Glib::Timeout->add(100,\&do);

Gtk2->main;

sub do
{ my ($pixmap,$mask)=$pb->render_pixmap_and_mask(1);
print STDERR ".";
}





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