Memory leak after multiple mogrify
-
- Posts: 8
- Joined: 2016-01-28T06:56:28-07:00
- Authentication code: 1151
Memory leak after multiple mogrify
I am using mogrify to process batches of 1365 .svg files into .bmp. After mogrify has finished there is 2.9 Mb less free Ram. (as seen in HTOP) This would not be a great problem except I am repeating the process hundreds of times as part of a shell script. I want to stress that the problem is what happens after mogrify closes, not while it is working (I solved that problem by switching from convert to mogrify).
I cannot reclaim this memory by stopping the scrip, closing the shell it is running in, deleting the svg or the bmp files, or the folder they are in. The only way I can reclaim this memory is by rebooting the computer. It looks as though it is allocated by mogrify every time it starts work but not freed after it closes.
I am using Linux Mint 17.2 Cinnamon on a ThinkPad T400 with 2Gb RAM.
The following line is in a shell script looping about once every minute. The batch mogrify takes about 45s of this.
mogrify -format bmp -compress none +matte s????.svg
I cannot reclaim this memory by stopping the scrip, closing the shell it is running in, deleting the svg or the bmp files, or the folder they are in. The only way I can reclaim this memory is by rebooting the computer. It looks as though it is allocated by mogrify every time it starts work but not freed after it closes.
I am using Linux Mint 17.2 Cinnamon on a ThinkPad T400 with 2Gb RAM.
The following line is in a shell script looping about once every minute. The batch mogrify takes about 45s of this.
mogrify -format bmp -compress none +matte s????.svg
Last edited by BobTateson on 2016-01-28T07:52:08-07:00, edited 1 time in total.
Re: Memory leak after multiple mogrify
And you are using the latest version of ImageMagick?
-
- Posts: 8
- Joined: 2016-01-28T06:56:28-07:00
- Authentication code: 1151
Re: Memory leak after multiple mogrify
Yes sorry I didnt say Imagemagick 6.7.7
Re: Memory leak after multiple mogrify
That version is ancient and we did fix a couple of memory leaks since that version. Could you give it a try with the latest version of ImageMagick?
-
- Posts: 8
- Joined: 2016-01-28T06:56:28-07:00
- Authentication code: 1151
Re: Memory leak after multiple mogrify
imagemagick 8:6.7.7.10-6ubuntu3
2014/03/06
is what is in the ubuntu repositary - thats what I have installed
what is the latest version?
2014/03/06
is what is in the ubuntu repositary - thats what I have installed
what is the latest version?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Memory leak after multiple mogrify
Latest IM version is 6.9.3.2. Yours is over 150 versions old.
-
- Posts: 8
- Joined: 2016-01-28T06:56:28-07:00
- Authentication code: 1151
Re: Memory leak after multiple mogrify
I managed to compile and install from the source
ImageMagick 6.9.3-2 Q16 x86_64 2016-01-28
Thought I was doing well. But tried it out to display a jpg and got
display: no decode delegate for this image format `JPEG' @ error/constitute.c/ReadImage/501.
This is obviously some kind of installation problem. Oh dear. I think I'll just go to bed.
Thanks for your help.
ImageMagick 6.9.3-2 Q16 x86_64 2016-01-28
Thought I was doing well. But tried it out to display a jpg and got
display: no decode delegate for this image format `JPEG' @ error/constitute.c/ReadImage/501.
This is obviously some kind of installation problem. Oh dear. I think I'll just go to bed.
Thanks for your help.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Memory leak after multiple mogrify
When installing from source, you must install all the needed delegates before compiling Imagemagick. If they are already installed, then you must point Imagemagick to where you have the delegates (such as JPG, PNG, TIFF, Ghostscript, fontconfig, freetype, etc).
see CPPFLAGS and LDFLAGS at http://www.imagemagick.org/script/advan ... #configure
see CPPFLAGS and LDFLAGS at http://www.imagemagick.org/script/advan ... #configure
-
- Posts: 8
- Joined: 2016-01-28T06:56:28-07:00
- Authentication code: 1151
Re: Memory leak after multiple mogrify
I have tried playing with the config but it's not installing everything. Sorry guys I think I am out of my depth here. I really don't know how to set the config options. And I don't expect you to waste your time teaching me. I will just have to live with the memory leaks on 6.7.7. and wait for the ubuntu repositary to hold the latest version of imagemagic. Thanks for your help anyway.
-
- Posts: 8
- Joined: 2016-01-28T06:56:28-07:00
- Authentication code: 1151
Re: Memory leak after multiple mogrify
I will have a go at installing 6.9. from source. I assume that if I am running 6.6 these 'delegates' are somewhere on my computer at the moment. What are they called? I only need the one for .svg and .bmp. If I know their names I can Find them and give the path to configure. Is that right?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Memory leak after multiple mogrify
both are built in -- no delegates that I know. For SVG, IM has an internal MSVG (XML), but you can install RSVG for better results. I do not know much about .bmp, but I have never installed any delegate for it, though it may need a subordinate delegate or come with some other delegate. Sorry, I do not know much about Linux.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Memory leak after multiple mogrify
For BMP, ImageMagick seems to contain the code to read/write, in coders\bmp.c.
For SVG, IM also contains code, in coders\svg.c. However, Inkscape is a more complete implementation. IM doesn't need special compilation to delegate reading to Inkscape. If Inkscape is in the system path at runtime, IM will find it and use it.
For SVG, IM also contains code, in coders\svg.c. However, Inkscape is a more complete implementation. IM doesn't need special compilation to delegate reading to Inkscape. If Inkscape is in the system path at runtime, IM will find it and use it.
snibgo's IM pages: im.snibgo.com
-
- Posts: 8
- Joined: 2016-01-28T06:56:28-07:00
- Authentication code: 1151
Re: Memory leak after multiple mogrify
Thanks for your help and suggestions. I have decided to give up trying to install imagemagick 6.9 from source.
As all I want to do is render large batches of .svg files into some bitmap form, I am going to investigate cairo. After all imagemagic uses cairo but is (for my needs) burdened with a vast amount of other functionality.
In the meantime I will continue to use mogrify from imagemagick 6.6. I have found a crude fix for the memory loss problem. When free memory is getting short, I force the computer into hibernate mode and then immediately wake it up. This reallocates all the RAM and frees up what was lost by imagemagic.
So thanks again guys.
As all I want to do is render large batches of .svg files into some bitmap form, I am going to investigate cairo. After all imagemagic uses cairo but is (for my needs) burdened with a vast amount of other functionality.
In the meantime I will continue to use mogrify from imagemagick 6.6. I have found a crude fix for the memory loss problem. When free memory is getting short, I force the computer into hibernate mode and then immediately wake it up. This reallocates all the RAM and frees up what was lost by imagemagic.
So thanks again guys.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Memory leak after multiple mogrify
If that's all you want to do, I suggest you look at Inkscape.BobTateson wrote:As all I want to do is render large batches of .svg files into some bitmap form ...
snibgo's IM pages: im.snibgo.com
-
- Posts: 8
- Joined: 2016-01-28T06:56:28-07:00
- Authentication code: 1151
Re: Memory leak after multiple mogrify
Good idea! I have just looked at inkscape and it has command line processing. That could well be a better bet than imagemagick. I will investigate further. Thanks.