[pigment] pgm_image_clear

ANTONI SILVESTRE PADROS antoni at tid.es
Thu Feb 26 16:11:23 CET 2009


Thanks a lot for the quick answer.

Actually I've only detected this problem in a dell studio hybrid with a Intel Integrated Graphics Media Accelerator X3100 with shared memory, but not in a desktop computer with a NVIDIA 8800, so I'm guessing it might be a driver problem...

Antoni Silvestre
________________________________________
De: Loïc Molinari [loic at fluendo.com]
Enviado el: miércoles, 25 de febrero de 2009 13:50
Para: ANTONI SILVESTRE PADROS
CC: pigment at lists.fluendo.com
Asunto: Re: [pigment] pgm_image_clear

Hi Antoni,

in most of the use cases, you don't have to clear your image since any
further image loading or destruction will do the clean up for you. For
instance, two following calls to pgm_image_set_from_file is a perfectly
valid scheme.

Regarding the memory issue, for having done a lot of tests to spot leaks
that can be implied through the process of changing the image in an
image, I'm almost sure there's no huge leak of image buffers. But if you
give us your profiling process and numbers, I would be glad to fix the
issue if it's there.

As a side note, be aware that Pigment's using the GLib slice allocator
which can false your tests optimizing the usage of raw malloc/free
calls. You can tell the GLib slice allocator to always fallback to
malloc by setting up the environment variable G_SLICE to always-malloc.

Regards.

On Wed, 2009-02-25 at 13:15 +0100, ANTONI SILVESTRE PADROS wrote:
> Hi, I have a question about the function pgm_image_clear, I have an image I use as a container that dynamically loads images from files. In order to do that first I use pgm_image_clear to free the previous image and then I use pgm_image_set_from_file to load the new one.
>
> The problem is that I've been profiling a little bit the program and it looks like pgm_image_clear doesn't really free the memory associated with the old image as after a few image changes more memory is used. I haven't seen any other way of changing the content of an image without actually destroying the image object and creating it again from scratch (and thus having to update any references pointing to it), so I'd like to make sure that pgm_image_clear really frees the memory associated with the previous image content.
>
> Thanks
>
> Antoni Silvestre

--
Loïc Molinari <loic at fluendo.com>


More information about the pigment mailing list