Is there any way to free Gimp memory and avoid restarting it?

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

Is there any way to free Gimp memory and avoid restarting it?

jEsuSdA 8)-2
Hi!


When editing several images in Gimp (10Mpixels each one), Gimp consumes
memory little by little (sometime not so little by little ;) ) and this
memory does not get free instead the images where closed.


So, after few time using Gimp, it consumes ALL MEMORY available and I
must close and start again.

Is there any way to force Gimp to free memory?

Why if I open a image, when I close it after editing the memory used by
Gimp for this image is not liberated?

I mean, if I load an image and the Gimp memory consumption increases
400MB, and I open another one (another 400MB more), I expect when I
close the first one, Gimp should free the 400MB of memory reserved to
the first image edition. Is something working wrong?


This is a very important think to me because I usually do long editing
session where I could retouch about 50 images and, obviously is very
annoying to close and restart Gimp every 5 or 6 processed images.


Thanks a lot.


GIMP 2.10.8 over Debian GNU/Linux (Testing)


_______________________________________________
gimp-developer-list mailing list
List address:    [hidden email]
List membership: https://mail.gnome.org/mailman/listinfo/gimp-developer-list
List archives:   https://mail.gnome.org/archives/gimp-developer-list
Reply | Threaded
Open this post in threaded view
|

Re: Is there any way to free Gimp memory and avoid restarting it?

jEsuSdA 8)-2
El 1/2/19 a las 23:15, jEsuSdA 8) escribió:

> Hi!
>
>
> When editing several images in Gimp (10Mpixels each one), Gimp consumes
> memory little by little (sometime not so little by little ;) ) and this
> memory does not get free instead the images where closed.
>
>
> So, after few time using Gimp, it consumes ALL MEMORY available and I
> must close and start again.
>
> Is there any way to force Gimp to free memory?
>
> Why if I open a image, when I close it after editing the memory used by
> Gimp for this image is not liberated?
>
> I mean, if I load an image and the Gimp memory consumption increases
> 400MB, and I open another one (another 400MB more), I expect when I
> close the first one, Gimp should free the 400MB of memory reserved to
> the first image edition. Is something working wrong?
>
>
> This is a very important think to me because I usually do long editing
> session where I could retouch about 50 images and, obviously is very
> annoying to close and restart Gimp every 5 or 6 processed images.
>
>
> Thanks a lot.
>
>
> GIMP 2.10.8 over Debian GNU/Linux (Testing)
>

Here some screenshots:


After opening and editing 3 images (10Mpix each one):


http://pasteall.org/pic/show.php?id=9066d31d4341eb69702b2dc223500215
http://pasteall.org/pic/show.php?id=6382dab480d0042e8d1479e226efb0e7

3 opened images = 4.4 GB of memory

Here, after opening, edit AND CLOSE 4 more images:

http://pasteall.org/pic/show.php?id=ee7a14d2803d7f62f0eb65d23c54650a
http://pasteall.org/pic/show.php?id=1f442cc78affbb9cde59be9e13e5a2d4


3 opened images = 6.3 GB of memory



Thanks! ;)
_______________________________________________
gimp-developer-list mailing list
List address:    [hidden email]
List membership: https://mail.gnome.org/mailman/listinfo/gimp-developer-list
List archives:   https://mail.gnome.org/archives/gimp-developer-list
Reply | Threaded
Open this post in threaded view
|

Re: Is there any way to free Gimp memory and avoid restarting it?

Ofnuts-2
On 2/1/19 11:35 PM, jEsuSdA 8) wrote:

> El 1/2/19 a las 23:15, jEsuSdA 8) escribió:
>> Hi!
>>
>>
>> When editing several images in Gimp (10Mpixels each one), Gimp
>> consumes memory little by little (sometime not so little by little ;)
>> ) and this memory does not get free instead the images where closed.
>>
>>
>> So, after few time using Gimp, it consumes ALL MEMORY available and I
>> must close and start again.
>>
>> Is there any way to force Gimp to free memory?
>>
>> Why if I open a image, when I close it after editing the memory used
>> by Gimp for this image is not liberated?
>>
>> I mean, if I load an image and the Gimp memory consumption increases
>> 400MB, and I open another one (another 400MB more), I expect when I
>> close the first one, Gimp should free the 400MB of memory reserved to
>> the first image edition. Is something working wrong?
>>
>>
>> This is a very important think to me because I usually do long
>> editing session where I could retouch about 50 images and, obviously
>> is very annoying to close and restart Gimp every 5 or 6 processed
>> images.
>>
>>
>> Thanks a lot.
>>
>>
>> GIMP 2.10.8 over Debian GNU/Linux (Testing)
>>
>
> Here some screenshots:
>
>
> After opening and editing 3 images (10Mpix each one):
>
>
> http://pasteall.org/pic/show.php?id=9066d31d4341eb69702b2dc223500215
> http://pasteall.org/pic/show.php?id=6382dab480d0042e8d1479e226efb0e7
>
> 3 opened images = 4.4 GB of memory
>
> Here, after opening, edit AND CLOSE 4 more images:
>
> http://pasteall.org/pic/show.php?id=ee7a14d2803d7f62f0eb65d23c54650a
> http://pasteall.org/pic/show.php?id=1f442cc78affbb9cde59be9e13e5a2d4
>
>
> 3 opened images = 6.3 GB of memory
>

The fact that the memory isn't marked free doesn't mean it is unusable.
Tried in Gimp 2.10 on Ubuntu:

- load 5 20MPx Jpegs: memory is 1.35GB

- close all: memory still at 1.35GB

- load them again: memory is 1.4GB

- close all: memory still at 1.4GB

- load them again: memory is 1.4GB

- close all: memory still at 1.4GB

So the memory seems reused...




_______________________________________________
gimp-developer-list mailing list
List address:    [hidden email]
List membership: https://mail.gnome.org/mailman/listinfo/gimp-developer-list
List archives:   https://mail.gnome.org/archives/gimp-developer-list
Reply | Threaded
Open this post in threaded view
|

Re: Is there any way to free Gimp memory and avoid restarting it?

jEsuSdA 8)-2
El 2/2/19 a las 9:58, Ofnuts escribió:

> The fact that the memory isn't marked free doesn't mean it is unusable.
> Tried in Gimp 2.10 on Ubuntu:
>
> - load 5 20MPx Jpegs: memory is 1.35GB
>
> - close all: memory still at 1.35GB
>
> - load them again: memory is 1.4GB
>
> - close all: memory still at 1.4GB
>
> - load them again: memory is 1.4GB
>
> - close all: memory still at 1.4GB
>
> So the memory seems reused...
>

Hi!

In my case, the memory marked as used is actually used (this is why I
send you the LXTask screenshots).

In fact, if I use Gimp for long time, it consumes all free memory and
linux has to use swap. This is why I have to restart Gimp.


Concerning your tests, I only can say that my own are not only opening
and closing images but doing few tasks on them: color adjust, few
filters, adding some layers and maks, etc.

Maybe this could makes some difference (e.g. the memory used for undo
actions).


This is my Gimp configuration (maybe it could help):

https://i.imgur.com/HC2BEbR.png


Thanks!
_______________________________________________
gimp-developer-list mailing list
List address:    [hidden email]
List membership: https://mail.gnome.org/mailman/listinfo/gimp-developer-list
List archives:   https://mail.gnome.org/archives/gimp-developer-list
Reply | Threaded
Open this post in threaded view
|

Re: Is there any way to free Gimp memory and avoid restarting it?

jEsuSdA 8)-2
In reply to this post by Ofnuts-2
El 2/2/19 a las 9:58, Ofnuts escribió:

> The fact that the memory isn't marked free doesn't mean it is unusable.
> Tried in Gimp 2.10 on Ubuntu:
>
> - load 5 20MPx Jpegs: memory is 1.35GB
>
> - close all: memory still at 1.35GB
>
> - load them again: memory is 1.4GB
>
> - close all: memory still at 1.4GB
>
> - load them again: memory is 1.4GB
>
> - close all: memory still at 1.4GB
>
> So the memory seems reused...

I was thinking about your tests and the values seems to be a bit
strange: I mean, I you load 5 images and Gimp takes 1.35GB Memory, why
when you close all the images gimp still taking 1.35GB instead of less than?

In the same way, if you load again the same images, why Gimp consumes
more memory and its memory consumption rises from 1.35 to 1.40... and,
again, when the images are closed the memory does not get back to a
lower value.

I think this values can corroborate my theory about Gimp lack of memory
release I suffer and which is absolutely needed when working in
professional environments.

Why Gimp does not free the memory?
Any idea?

Thanks!
_______________________________________________
gimp-developer-list mailing list
List address:    [hidden email]
List membership: https://mail.gnome.org/mailman/listinfo/gimp-developer-list
List archives:   https://mail.gnome.org/archives/gimp-developer-list
Reply | Threaded
Open this post in threaded view
|

Re: Is there any way to free Gimp memory and avoid restarting it?

Øyvind Kolås-2
On Tue, Feb 5, 2019 at 4:35 PM jEsuSdA 8) <[hidden email]> wrote:

> > So the memory seems reused...
>
> I was thinking about your tests and the values seems to be a bit
> strange: I mean, I you load 5 images and Gimp takes 1.35GB Memory, why
> when you close all the images gimp still taking 1.35GB instead of less than?
>
> In the same way, if you load again the same images, why Gimp consumes
> more memory and its memory consumption rises from 1.35 to 1.40... and,
> again, when the images are closed the memory does not get back to a
> lower value.

If you need to restrict the amount of memory GIMP is permitted to use
(before swapping tiles of the image out to disk and being slower) you
should adjust the tile-cache-size in GIMP's preferences.

Apart from memory leaks which are bugs, GIMP/GEGL are telling the used
memory allocators that memory is no longer used - lower levels of the
stack however do not free up used memory. By design allocators tend to
keep freed memory around for reuse in future allocation calls, for
more information see:
https://stackoverflow.com/questions/5994543/problem-usage-memory-in-c/5994981#5994981
_______________________________________________
gimp-developer-list mailing list
List address:    [hidden email]
List membership: https://mail.gnome.org/mailman/listinfo/gimp-developer-list
List archives:   https://mail.gnome.org/archives/gimp-developer-list
Reply | Threaded
Open this post in threaded view
|

Re: Is there any way to free Gimp memory and avoid restarting it?

Ofnuts-2
In reply to this post by jEsuSdA 8)-2
On 2/5/19 5:35 PM, jEsuSdA 8) wrote:

> El 2/2/19 a las 9:58, Ofnuts escribió:
>> The fact that the memory isn't marked free doesn't mean it is
>> unusable. Tried in Gimp 2.10 on Ubuntu:
>>
>> - load 5 20MPx Jpegs: memory is 1.35GB
>>
>> - close all: memory still at 1.35GB
>>
>> - load them again: memory is 1.4GB
>>
>> - close all: memory still at 1.4GB
>>
>> - load them again: memory is 1.4GB
>>
>> - close all: memory still at 1.4GB
>>
>> So the memory seems reused...
>
> I was thinking about your tests and the values seems to be a bit
> strange: I mean, I you load 5 images and Gimp takes 1.35GB Memory, why
> when you close all the images gimp still taking 1.35GB instead of less
> than?
>
> In the same way, if you load again the same images, why Gimp consumes
> more memory and its memory consumption rises from 1.35 to 1.40... and,
> again, when the images are closed the memory does not get back to a
> lower value.
>
> I think this values can corroborate my theory about Gimp lack of
> memory release I suffer and which is absolutely needed when working in
> professional environments.
>
> Why Gimp does not free the memory?
> Any idea?


If memory was truly leaked,  I would have seen 1.35, 2.7, 4.05... Since
there is no significant memory increase, we can assume that this memory
is reused. For the rest, see Øyvind's answer.

_______________________________________________
gimp-developer-list mailing list
List address:    [hidden email]
List membership: https://mail.gnome.org/mailman/listinfo/gimp-developer-list
List archives:   https://mail.gnome.org/archives/gimp-developer-list
Reply | Threaded
Open this post in threaded view
|

Re: Is there any way to free Gimp memory and avoid restarting it?

Developers mailing list
Does GIMP clear undo memory associated with images that have been closed
(without closing GIMP)?
Thanks for the great answers, everyone. I'm learning a lot about GIMP
memory management here!

-C

On Wed, Feb 6, 2019 at 9:14 AM Ofnuts <[hidden email]> wrote:

> On 2/5/19 5:35 PM, jEsuSdA 8) wrote:
> > El 2/2/19 a las 9:58, Ofnuts escribió:
> >> The fact that the memory isn't marked free doesn't mean it is
> >> unusable. Tried in Gimp 2.10 on Ubuntu:
> >>
> >> - load 5 20MPx Jpegs: memory is 1.35GB
> >>
> >> - close all: memory still at 1.35GB
> >>
> >> - load them again: memory is 1.4GB
> >>
> >> - close all: memory still at 1.4GB
> >>
> >> - load them again: memory is 1.4GB
> >>
> >> - close all: memory still at 1.4GB
> >>
> >> So the memory seems reused...
> >
> > I was thinking about your tests and the values seems to be a bit
> > strange: I mean, I you load 5 images and Gimp takes 1.35GB Memory, why
> > when you close all the images gimp still taking 1.35GB instead of less
> > than?
> >
> > In the same way, if you load again the same images, why Gimp consumes
> > more memory and its memory consumption rises from 1.35 to 1.40... and,
> > again, when the images are closed the memory does not get back to a
> > lower value.
> >
> > I think this values can corroborate my theory about Gimp lack of
> > memory release I suffer and which is absolutely needed when working in
> > professional environments.
> >
> > Why Gimp does not free the memory?
> > Any idea?
>
>
> If memory was truly leaked,  I would have seen 1.35, 2.7, 4.05... Since
> there is no significant memory increase, we can assume that this memory
> is reused. For the rest, see Øyvind's answer.
>
> _______________________________________________
> gimp-developer-list mailing list
> List address:    [hidden email]
> List membership:
> https://mail.gnome.org/mailman/listinfo/gimp-developer-list
> List archives:   https://mail.gnome.org/archives/gimp-developer-list
>
_______________________________________________
gimp-developer-list mailing list
List address:    [hidden email]
List membership: https://mail.gnome.org/mailman/listinfo/gimp-developer-list
List archives:   https://mail.gnome.org/archives/gimp-developer-list
Reply | Threaded
Open this post in threaded view
|

Re: Is there any way to free Gimp memory and avoid restarting it?

Robert Krawitz-2
In reply to this post by Ofnuts-2
On Wed, 6 Feb 2019 11:14:21 +0200, Ofnuts wrote:

> On 2/5/19 5:35 PM, jEsuSdA 8) wrote:
>> El 2/2/19 a las 9:58, Ofnuts escribió:
>>> The fact that the memory isn't marked free doesn't mean it is
>>> unusable. Tried in Gimp 2.10 on Ubuntu:
>>>
>>> - load 5 20MPx Jpegs: memory is 1.35GB
>>>
>>> - close all: memory still at 1.35GB
>>>
>>> - load them again: memory is 1.4GB
>>>
>>> - close all: memory still at 1.4GB
>>>
>>> - load them again: memory is 1.4GB
>>>
>>> - close all: memory still at 1.4GB
>>>
>>> So the memory seems reused...
>>
>> I was thinking about your tests and the values seems to be a bit
>> strange: I mean, I you load 5 images and Gimp takes 1.35GB Memory, why
>> when you close all the images gimp still taking 1.35GB instead of less
>> than?
>>
>> In the same way, if you load again the same images, why Gimp consumes
>> more memory and its memory consumption rises from 1.35 to 1.40... and,
>> again, when the images are closed the memory does not get back to a
>> lower value.
>>
>> I think this values can corroborate my theory about Gimp lack of
>> memory release I suffer and which is absolutely needed when working in
>> professional environments.
>>
>> Why Gimp does not free the memory?
>> Any idea?
>
> If memory was truly leaked,  I would have seen 1.35, 2.7,
> 4.05... Since there is no significant memory increase, we can assume
> that this memory is reused. For the rest, see Øyvind's answer.

It's possible that some memory was leaked, just not all of it.
--
Robert Krawitz                                     <[hidden email]>

***  MIT Engineers   A Proud Tradition   http://mitathletics.com  ***
Member of the League for Programming Freedom  --  http://ProgFree.org
Project lead for Gutenprint   --    http://gimp-print.sourceforge.net

"Linux doesn't dictate how I work, I dictate how Linux works."
--Eric Crampton
_______________________________________________
gimp-developer-list mailing list
List address:    [hidden email]
List membership: https://mail.gnome.org/mailman/listinfo/gimp-developer-list
List archives:   https://mail.gnome.org/archives/gimp-developer-list
Reply | Threaded
Open this post in threaded view
|

Re: Is there any way to free Gimp memory and avoid restarting it?

Developers mailing list
I think you should open a bug report:
https://www.gimp.org/bugs/

Robert Krawitz <[hidden email]> escreveu no dia quarta, 6/02/2019 à(s) 13:34:

>
> On Wed, 6 Feb 2019 11:14:21 +0200, Ofnuts wrote:
> > On 2/5/19 5:35 PM, jEsuSdA 8) wrote:
> >> El 2/2/19 a las 9:58, Ofnuts escribió:
> >>> The fact that the memory isn't marked free doesn't mean it is
> >>> unusable. Tried in Gimp 2.10 on Ubuntu:
> >>>
> >>> - load 5 20MPx Jpegs: memory is 1.35GB
> >>>
> >>> - close all: memory still at 1.35GB
> >>>
> >>> - load them again: memory is 1.4GB
> >>>
> >>> - close all: memory still at 1.4GB
> >>>
> >>> - load them again: memory is 1.4GB
> >>>
> >>> - close all: memory still at 1.4GB
> >>>
> >>> So the memory seems reused...
> >>
> >> I was thinking about your tests and the values seems to be a bit
> >> strange: I mean, I you load 5 images and Gimp takes 1.35GB Memory, why
> >> when you close all the images gimp still taking 1.35GB instead of less
> >> than?
> >>
> >> In the same way, if you load again the same images, why Gimp consumes
> >> more memory and its memory consumption rises from 1.35 to 1.40... and,
> >> again, when the images are closed the memory does not get back to a
> >> lower value.
> >>
> >> I think this values can corroborate my theory about Gimp lack of
> >> memory release I suffer and which is absolutely needed when working in
> >> professional environments.
> >>
> >> Why Gimp does not free the memory?
> >> Any idea?
> >
> > If memory was truly leaked,  I would have seen 1.35, 2.7,
> > 4.05... Since there is no significant memory increase, we can assume
> > that this memory is reused. For the rest, see Øyvind's answer.
>
> It's possible that some memory was leaked, just not all of it.
> --
> Robert Krawitz                                     <[hidden email]>
>
> ***  MIT Engineers   A Proud Tradition   http://mitathletics.com  ***
> Member of the League for Programming Freedom  --  http://ProgFree.org
> Project lead for Gutenprint   --    http://gimp-print.sourceforge.net
>
> "Linux doesn't dictate how I work, I dictate how Linux works."
> --Eric Crampton
> _______________________________________________
> gimp-developer-list mailing list
> List address:    [hidden email]
> List membership: https://mail.gnome.org/mailman/listinfo/gimp-developer-list
> List archives:   https://mail.gnome.org/archives/gimp-developer-list
_______________________________________________
gimp-developer-list mailing list
List address:    [hidden email]
List membership: https://mail.gnome.org/mailman/listinfo/gimp-developer-list
List archives:   https://mail.gnome.org/archives/gimp-developer-list
Reply | Threaded
Open this post in threaded view
|

Re: Is there any way to free Gimp memory and avoid restarting it?

Peter Suetterlin
In reply to this post by Øyvind Kolås-2
Øyvind Kolås wrote:

> If you need to restrict the amount of memory GIMP is permitted to use
> (before swapping tiles of the image out to disk and being slower) you
> should adjust the tile-cache-size in GIMP's preferences.

Well, you do want GIMP to use the memory if it needs it.

> Apart from memory leaks which are bugs, GIMP/GEGL are telling the used
> memory allocators that memory is no longer used - lower levels of the
> stack however do not free up used memory. By design allocators tend to
> keep freed memory around for reuse in future allocation calls,

But this is not very social to other programs running on the same machine, is
it?  I have noticed this behavior of GIMP myself before, and also thought this
is not how it should be...
_______________________________________________
gimp-developer-list mailing list
List address:    [hidden email]
List membership: https://mail.gnome.org/mailman/listinfo/gimp-developer-list
List archives:   https://mail.gnome.org/archives/gimp-developer-list
Reply | Threaded
Open this post in threaded view
|

Re: Is there any way to free Gimp memory and avoid restarting it?

Liam R E Quin
On Wed, 2019-02-06 at 18:23 +0100, Peter Suetterlin wrote:
> By design allocators tend
> > to
> > keep freed memory around for reuse in future allocation calls,
>
> But this is not very social to other programs running on the same
> machine, is
> it?  I have noticed this behavior of GIMP myself before, and also
> thought this is not how it should be...

It’s the default behaviour for almost all programs. On Linux systems
you may be able to set M_TRIM_THRESHOLD_ to return memory to the
operating system in some circumstances, and also MALLOC_MMAP_THRESHOLD_
to make malloc() allocate memory in a way that gets reused more easily.
See the man page for mallopt.

On Unix systems (including Linux and Mac OS X) this behaviour is not
especially unfriendly: the unused space isn’t necessarily kept in main
memory.

Liam


--
Liam Quin - web slave for https://www.fromoldbooks.org/
with fabulous vintage art and fascinating texts to read.
Click here to have the slave beaten.

_______________________________________________
gimp-developer-list mailing list
List address:    [hidden email]
List membership: https://mail.gnome.org/mailman/listinfo/gimp-developer-list
List archives:   https://mail.gnome.org/archives/gimp-developer-list