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



On 02/16/2012 05:42 AM, Tom Vrankar wrote:

>    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)

If you eschew creating a new display for each image, your script should run significantly faster. Creating a new image is quite quick, however, creating a new display takes quite a bit of time.

Another option -- if you desire to see the images as they are processed -- is to use the PDB function 'gimp-displays-reconnect' to reconnect a single display to each image as it is processed. This will obviate having to create a new display and avoid regenerating the GTK menus (which makes creating a new display take so long). Note that you will still need to delete the old image (to avoid a memory leak) after the new connection is made.







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