Posts: 61
Threads: 16
Joined: Apr 2020
Reputation:
1
Operating system(s):
Gimp version: 2.10
09-02-2020, 07:52 AM
(This post was last modified: 09-02-2020, 07:53 AM by ChameleonScales.)
I made a script that creates xcfs, does a few things and saves them. Problem is, it gradually fills up my memory when I execute it on many files.
The last command of the loop is pdb.gimp_xcf_save. So I wonder if I need to add a command to close the xcf of somehow clear the memory, but I didn't find such a thing.
Any idea?
Posts: 301
Threads: 12
Joined: Oct 2016
Reputation:
16
Operating system(s):
- Windows (Vista and later)
Gimp version: 2.10
If you're doing a gimp-image-new, then a gimp-image-delete should clean up
Posts: 6,342
Threads: 274
Joined: Oct 2016
Reputation:
563
Operating system(s):
Gimp version: 2.10
Or in python, gimp.delete(image)
Posts: 61
Threads: 16
Joined: Apr 2020
Reputation:
1
Operating system(s):
Gimp version: 2.10
02-09-2021, 11:22 AM
(This post was last modified: 02-09-2021, 11:23 AM by ChameleonScales.)
Forgot to give my definite answer:
gimp.delete(image) worked, no more filled memory. Thanks!
Posts: 61
Threads: 16
Joined: Apr 2020
Reputation:
1
Operating system(s):
Gimp version: 2.10
03-08-2021, 02:21 PM
(This post was last modified: 03-08-2021, 03:09 PM by ChameleonScales.)
I again have a memory filling issue even using gimp.delete(image). I checked for proper position of the command in my loop by inserting a print(image) right before and it's well positioned.
It seems Gimp keeps non inserted layers even after deleting the image, which surprises me because the command to load them needs an image in the arguments: pdb.gimp_file_load_layer(image, filename) so I assume they are still assigned to an image and should be flushed with it, but according to my test that's not the case.
Is there a way to list all the non inserted layers so I can delete them all?
Posts: 61
Threads: 16
Joined: Apr 2020
Reputation:
1
Operating system(s):
Gimp version: 2.10
03-08-2021, 04:16 PM
(This post was last modified: 03-08-2021, 04:17 PM by ChameleonScales.)
Ok so I confirm that non inserted layers are kept and I could prevent having any remaining ones before the image gets deleted, so no need to list them (still curious to know if that's possible though).
I however get a segmentation fault and crash when trying to print a non inserted layer after deleting it with pdb.gimp_item_delete. Is this expected or should I make a bug report ?