2.3 Memory usage and leaks
This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.
This is a read-only list on gimpusers.com so this discussion thread is read-only, too.
2.3 Memory usage and leaks | Akkana Peck | 14 Jul 00:47 |
2.3 Memory usage and leaks | Sven Neumann | 16 Jul 17:27 |
2.3 Memory usage and leaks | Sven Neumann | 17 Jul 09:28 |
2.3 Memory usage and leaks | Akkana Peck | 18 Jul 22:10 |
2.3 Memory usage and leaks | Sven Neumann | 18 Jul 22:40 |
2.3 Memory usage and leaks
I just found my (wimpy laptop) machine running slowly after processing a few (4) images with gimp from current svn (with several scales, a crop and several saves) then closing all the image windows. I ran a quick memory check and discovered that gimp was using 51Mb despite not having any images open.
I played around with gmemusage to get a feel for what was going on. GIMP 2.3 uses between 33.9 and 35.0 Mb on startup (no images loaded, and I don't know why it isn't always the same). For comparison, 2.2.13 uses about 13.9 Mb at startup, so it's increased by a factor of about 2.5 just for the base app, before images.
Each time I load an image then close the image window without doing anything, gimp grows by some variable amount, ranging from half a Mb to 2Mb (perhaps related to the size of the image). If I do operations on the image before closing it, these cause it to grow more: doing a crop and a scale almost always makes it grow 2Mb even with a relatively small image.
This seems like a memory leak (there's no usable history once an image is closed, right? so basically it's back in the same state it was before, except using more memory). Or is there useful information that's being saved about each image? I know there's one name and thumbnail added to the Recent Images list, but surely that doesn't account for 2Mb. Nobody on #gimp knew much about it when I asked, and there was some agreement that it sounded like a leak.
However, I also see this ~2Mb growth in 2.2, so if it's a memory leak, it's not a new one.
So my questions are:
- Is the growth that comes from loading an image, doing operations on it then closing the window expected? What is this memory being used for?
- Is anyone concerned about gimp's minimal profile having risen from 14M to 35M?
If there's agreement that there's a problem I can file a bug and maybe dig in more detail into where the memory's going, but I wanted to ask here first.
...Akkana
2.3 Memory usage and leaks
Hi,
On Fri, 2007-07-13 at 15:47 -0700, Akkana Peck wrote:
I played around with gmemusage to get a feel for what was going on. GIMP 2.3 uses between 33.9 and 35.0 Mb on startup (no images loaded, and I don't know why it isn't always the same). For comparison, 2.2.13 uses about 13.9 Mb at startup, so it's increased by a factor of about 2.5 just for the base app, before images.
What does gmemusage display? Does it only look at malloc'ed pages or does it also take code size into account?
Each time I load an image then close the image window without doing anything, gimp grows by some variable amount, ranging from half a Mb to 2Mb (perhaps related to the size of the image). If I do operations on the image before closing it, these cause it to grow more: doing a crop and a scale almost always makes it grow 2Mb even with a relatively small image.
That's not a useful measure as it doesn't take memory pools into account. glibc has memory pools and gimp 2.3 also makes heavy use of GSlice.
So my questions are:
- Is the growth that comes from loading an image, doing operations on it then closing the window expected? What is this memory being used for?
At least to some extend this is expected. But it shouldn't grow with each image.
- Is anyone concerned about gimp's minimal profile having risen from 14M to 35M?
I would definitely be concerned but since I don't know what gmemusage does and since I don't know anything about the differences between your gimp 2.2 and gimp 2.3 installation, there's not much we can do.
If you suspect a memory leak, you should use valgrind to verify that. And you should run gimp with G_SLICE=always-malloc when doing that.
Sven
2.3 Memory usage and leaks
Hi,
On Fri, 2007-07-13 at 15:47 -0700, Akkana Peck wrote:
I played around with gmemusage to get a feel for what was going on. GIMP 2.3 uses between 33.9 and 35.0 Mb on startup (no images loaded, and I don't know why it isn't always the same). For comparison, 2.2.13 uses about 13.9 Mb at startup, so it's increased by a factor of about 2.5 just for the base app, before images.
That is most likely because your copy of gimp-2.3 has debugging symbols while your copy of gimp-2.2 doesn't. I wouldn't be surprised if gimp-2.3 uses a little more memory than gimp-2.2 but the difference should be marginal.
Each time I load an image then close the image window without doing anything, gimp grows by some variable amount, ranging from half a Mb to 2Mb (perhaps related to the size of the image). If I do operations on the image before closing it, these cause it to grow more: doing a crop and a scale almost always makes it grow 2Mb even with a relatively small image.
I have tested this in valgrind and it doesn't show me any memory leaks. Can you reproduce this with G_SLICE=always-malloc ?
Sven
2.3 Memory usage and leaks
Sven Neumann writes:
What does gmemusage display? Does it only look at malloc'ed pages or does it also take code size into account?
I'm not sure. I think it's all of the above.
On Fri, 2007-07-13 at 15:47 -0700, Akkana Peck wrote:
I played around with gmemusage to get a feel for what was going on. GIMP 2.3 uses between 33.9 and 35.0 Mb on startup (no images loaded, and I don't know why it isn't always the same). For comparison, 2.2.13 uses about 13.9 Mb at startup, so it's increased by a factor of about 2.5 just for the base app, before images.
That is most likely because your copy of gimp-2.3 has debugging symbols while your copy of gimp-2.2 doesn't. I wouldn't be surprised if gimp-2.3
That's a good point! But surprisingly, stripping the gimp-2.3 binary and all the libraries in lib doesn't make much difference -- the stripped 2.3 still takes 33M at startup.
Top showed: VIRT RES SHR %MEM gimp 2.3 56600 24m 10m 13.1 gimp 2.2 35984 20M 9.8m 11.2
I haven't tested in valgrind yet, or with G_SLICE=always-malloc, but I'll do some more experimenting (probably not for a few days ... I have some projects coming due).
...Akkana
2.3 Memory usage and leaks
Hi,
On Wed, 2007-07-18 at 13:10 -0700, Akkana Peck wrote:
That's a good point! But surprisingly, stripping the gimp-2.3 binary and all the libraries in lib doesn't make much difference -- the stripped 2.3 still takes 33M at startup.
Top showed: VIRT RES SHR %MEM gimp 2.3 56600 24m 10m 13.1 gimp 2.2 35984 20M 9.8m 11.2
That looks just as expected. Nothing to worry about.
Sven