Page 1 of 1
Convert exceeds memory limit
Posted: 2006-11-24T06:28:19-07:00
by sven
Hello magick,
when using the following command the memory consumption exceeds the given limit (300 MB and more are consumed):
Code: Select all
convert -limit memory 16 -limit map 16 -compress JPEG -quality 80 -density 152.4 -sample 50% D:\test1.tif D:\test1b.pdf
Version: ImageMagick 6.3.0 11/22/06 Q8 http://www.imagemagick.org
Is there a way to solve this issue?
Thanks a lot for your help.
Best regards
Sven
Posted: 2006-11-24T09:41:10-07:00
by magick
The memory/map limits only affect the image pixel cache. Other algorithms consume as much memory as required. We suspect the problem is that JPEG-compressed PDFs are generated as memory blobs. We can reduce memory consumption by performing the compression on disk. We'll get a patch into the next release of ImageMagick.
Posted: 2006-11-24T10:22:38-07:00
by sven
Hello magick,
Thanks for your quick reply.
Is there any other chance to limit the memory usage of ImageMagick?
The problem is that conversions with huge images may lead to a crash of the system, because of a too high memory consumption.
Will your change also affect other programs like "compare"? That would be great.
Kind regards
Sven
Posted: 2006-11-24T11:09:05-07:00
by magick
No user program requesting memory should crash a system. That would be a bug in the operating system. For some algorithms, ImageMagick memory requirements are proportional to the area of the image. The only way around that is to identify which algorithm is consuming memory and avoid it or use some other program.
Posted: 2006-11-30T04:49:06-07:00
by sven
magick wrote:
The memory/map limits only affect the image pixel cache. Other algorithms consume as much memory as required. We suspect the problem is that JPEG-compressed PDFs are generated as memory blobs. We can reduce memory consumption by performing the compression on disk. We'll get a patch into the next release of ImageMagick.
Hi again,
has the patch already already been included into the most recent release of ImageMagick?
Best regards
Sven
Posted: 2006-11-30T09:08:41-07:00
by magick
The patch is available in ImageMagick 6.3.0-8 Beta. It will be released within a week or two.
Posted: 2006-12-03T15:41:51-07:00
by sven
I've just installed the most recent version (6.3.1.0) of ImageMagick.
Can you tell me how to see, if the PDF JPEG compression consumes less memory than in earlier version? I don't see any differences...
Thanks a lot and best regards
Sven
Posted: 2006-12-03T18:16:45-07:00
by magick
Its possible something other than JPEG is consuming memory. Embedded JPEG within PDF is written to disk in ImageMagick 6.3.1 rather than a memory blob (see JPEGEncodeImage()). You also need to set the memory limit to something small to turn off JPEG optimization which is memory intensive (e.g. -limit memory 1).