Re: [Gimp-developer] Python FU Scripting -- Memory Leak? or How to release python gimp objects properly to manage memory usage?

On Tue, 2012-02-28 at 10:52 -0500, Kevin Cozens wrote:
> On 12-02-15 11:42 PM, Tom Vrankar wrote:
> > Here's the simple command sequence that demonstrates the "leak".
> [snip]
> > img =gp.gimp_image_new (1280, 720, 0)
> > dsp =gp.gimp_display_new (img)
> > lyr =gp.gimp_layer_new_from_drawable (src.layers[1], img)
> > img.insert_layer (lyr, position =0)
> > gp.gimp_display_delete (dsp)
> >
> > I see memory use jump after each iteration. Any help is appreciated.
> You are creating and destroying the display but you aren't doing the same 
> with the image. You should call gimp_image_delete() after you call 
> gimp_display_delete once you no longer need the image.

Sorry, not true. The image's first display takes ownership of the image,
further displays merely ref it. gimp_image_delete() has no effect when
there is a display, and for images with displays you would delete all
displays to get rid of the image.

Tom, try doing this in a loop like 100 times, the memory consumption
will stay about the same. There is a lot of memory caching going on in
glib and gimp.


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