RE: [gtkmm] how to free a pixbuf



> The pixbuf's memory will be released when the last reference is released.
> That's not for you to worry about because the RefPtr should worry about it
> for you. If there seems to be a memory leak (not impossible - we've seen
> them before) then please do make a simple-as-possible compileable test case
> and put it in bugzilla.

I don't think it's RefPtr's fault. I am forced to maintain a RefPtr for
the duration of the entire program, for display purposes (in an
expose_event callback), after the pixbuf has been read from the disk.
However, if I read a new image into the same pixbuf using
create_from_file(), the old memory is not released, as the RefPtr still
exists, but new memory is allocated by create_from_file().

Should RefPtr automatically release the old memory when it is assigned new
memory? If so, than that's a bug, because it's not happening. Otherwise,
my design is wrong (reading from the disk several images into the same
pixbuf), but I don't see a way around it.

Thanks!





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