GNOME Bugzilla – Bug 525016
Gimp-Perl memory leak
Last modified: 2014-03-26 18:56:08 UTC
The following was originally sent to the GIMP developer mailing list by Andrei Simion: I run Gimp 2.2 on a Red Hat machine. The Perl scripts delete the images that are created by using gimp_image_delete. Even so, the swap file is created and it inflates significantly. For instance, after creating 250 images its size is of 2.7 GB. If the image is not deleted in the script, then after the same amount of images created the size of the swap file is of 900 MB. I would be interested in eliminating the swap file or at least limiting its size. I think it should resize itself, but this doesn't happen. Is there a setting in gimprc for this?
Andrei has since reported that the problem still happens with the 2.4.5 version of GIMP.
This report is pointless without the script that causes the problem. Please attach a small script here that shows the problem. Setting to NEEDINFO until then.
Sven, if you had been following the "Gimp-Perl leak" thread on gimp-devel you would know that the script is proprietary to the company for which the reporter works. As I did some work for the company I have a copy of the script and had already stated my intention to investigate. I will attach a script once I have a simpler version that can reproduce the problem.
Created attachment 110044 [details] Test script to demonstrate memory leak Additional information from Andrei: I was told to install version 2.4 and the issue doesn't go away. The problem is that I discovered something even worst and it does take place in both 2.2 and 2.4. If one runs a Gimp-Perl script for a number of times, enough to use the whole physical memory, then the Gimp server crashes, it does not create the swap. That's it, no swap file is created. I think there may be a configuration issue.
Created attachment 110914 [details] Valgrind output which confirms some sort of memory leakage. The attached file was captured on April 23, 2008 and seems to confirm the presence of memory leak(s). The output shows valgrind output from a run of version 2.5 of GIMP with the environment variable GSLICE set to always-malloc. GIMP was started, one Script-Fu script was run, and GIMP closed. Sven has seen one of the valgrind reports I generated and feels that the leak is caused by something within GIMP.
Oops...typo in my last comment. I meant to say that Sven felt that the leak was *NOT* in something within GIMP.
It has been over a year with nothing further on this reported bug. It needs to be checked again to see what leaks my still exist. Looking again at the valgrind output shows that the memory reported as "definitely lost" was from something to do with libdl, fontconfig, and a pango library.
So as the necessary steps are clear and no question for non-developers are open, I reopen this bug then so that someone with free time at their hands can pick this up.
The valgrind output was for GIMP, and gimp-perl operates within another process for the Perl-Server, and one per plugin/filter. There was some memory leakage in the current GP, and the attached patch addresses that.
Created attachment 272111 [details] [review] Patch fcd8b703b1bce88f1daf2742f9f536839fab650b
Review of attachment 272111 [details] [review]: This patch won't apply to the current code base. gimp2/gimp-perl/.git/rebase-apply/patch:64: space before tab in indent. arg->data.d_int32 = sv2gimp_extract_noref (SvIV, "INT32"); break; error: patch failed: t/perlplugin.t:9 error: t/perlplugin.t: patch does not apply Patch failed at 0001 Eliminate some memory leaking. Bug 525016 When you have resolved this problem run "git am --resolved". If you would prefer to skip this patch, instead run "git am --skip". To restore the original branch and stop patching run "git am --abort".
FYI: the patch generates another white space warning. /home/kcozens/gimp2/gimp-perl/.git/rebase-apply/patch:64: space before tab in indent. arg->data.d_int32 = sv2gimp_extract_noref (SvIV, "INT32"); break; warning: 1 line adds whitespace errors. commit bdf6c8b1cb0297f9bb7129fe075f1134d485122e Author: Ed J <m8r-35s8eo@mailinator.com> Date: Mon Mar 17 03:32:07 2014 +0000 Eliminate some memory leaking. Bug 525016