Memory problems with gdk_pixbuf
- From: John Coppens <john jcoppens com>
- To: gtk-app-devel-list gnome org
- Subject: Memory problems with gdk_pixbuf
- Date: Mon, 6 Jun 2005 14:10:49 -0300
Hello people.
A few weeks ago I posted a message about memory leaking. I haven't solved
the problem yet (thanks for a few privately received suggestions though).
The example below is taken largely from the GGAD manual, but, if the
segment is called repeatedly, allocates large chunks of memory, until a
certain point, where things break ('process killed')
--------------
global variable GnomeCanvasItem *img_item = NULL;
--------------
pxb = gdk_pixbuf_new_from_file(path, &err);
// Check if the image was previously allocated. If so, destroy it
// Note that this relies on the pxb being destroyed too. It seems
// this does _not_ happen (Valgrind indicate this)
if (img_item)
gtk_object_destroy(GTK_OBJECT(img_item));
img_item = gnome_canvas_item_new(root,
gnome_canvas_pixbuf_get_type(),
"pixbuf", pxb,
"x", 0.0, "y", 0.0,
"width", pxb_w, "height", pxb_h,
NULL);
gdk_pixbuf_unref(pxb);
--------------
My question is, what is the mechanism to destroy canvas items so that all
resources are freed too. (The above is derived from example in the GGAD, I
believe). Do I have to free the pxb manually?
John
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]