Re: Correct use of pixbuf, pixmap, and image?

Ari Jolma wrote:

looking at process info, it seems that X is piling up memory, the code
   $self->{pixmap} = $self->{pixbuf}->render_pixmap_and_mask;

I've still seem to have a problem with this. I did a bit of research and it seems that GtkImage's set_from_pixmap increases the ref_count of the pixmap, thus the pixmap ends up with two ref_count two (I build NOISY Glib to confirm this) and thus X does not free its memory.

Is there a way to unset the pixmap from the image or force the destroying of the pixmap? Recreating the image at this point in code does not work right away.

Sorry for flooding. I tested a simple xs function which is essentially this:

while (object->ref_count > 1) {
        g_object_unref (object);

which I call with pixmap once I'm sure it is not used any more (after new one is created and set to the image). The while is needed because set_from_pixmap might be called several times to refresh the image on the screen. After using this the X server does not pile up memory any more.

I could not find any example where pixmap is used this way as an offscreen drawable.


gtk-perl-list mailing list
gtk-perl-list gnome org

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