Re: [gtkmm] how to free a pixbuf



On Wed, Oct 15, 2003 at 11:58:59AM -0400, Silviu D Minut wrote:
> (the pixbuf) is already being displayed in a DrawingArea. Does that count
> as a reference? Other than that, there is no other RefPtr pointing to the
> same pixbuf_.

Well, I'm not sure about that, but I assume that the pixbuf in the
DrawingArea counts as a reference until you display a new pixbuf, and
the DrawingArea discards the old one. I noticed that the DrawingArea is
for custom widgets, so I have no idea how you use it...

You may want to write a small test loop for verify RefPtr's functioning
and check the memory usage during the program's runtime:

{
  Glib::RefPtr<Gdk::Pixbuf> mypixbuf;
  for (int i = 0; i < 100; ++i)
    mypixbuf = Gdk::Pixbuf::create_from_file(filename);
}

Regards.

-- 
Simon Fuhrmann | NightSlayer at gmx.de | http://www.dismember.de
All people talk about the real life, but where can I download it?



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