Imagemagick ignores all memory limits

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
yanpas
Posts: 1
Joined: 2015-12-22T14:44:18-07:00
Authentication code: 1151

Imagemagick ignores all memory limits

Post by yanpas »

I want to compress big pdf, here is what I enter:

Code: Select all

 parallel -P -1 convert {} -compress JPEG -quality 80 -resize 1100 -limit memory 128MiB -limit map 256Mib -limit area 256Mib compressed-{} ::: %N 
or the same

Code: Select all

convert in.pdf -compress JPEG -quality 80 -resize 1100 -limit memory 128MiB -limit map 256Mib -limit area 256Mib compressed-pdf.pdf 
.
And here is what is going on: first, ghostscript starts, it works for several minutes and consumes about 100MB of memory, then convert process starts and it eats 3 GB of mmory, it can eat even more, but I have to kill it. What am I doing wrong?

PDF consists of 300 pages and 150MB size. I have no idea why IM needs so much memory for 150mb pdf...

Version 6.7.7-10
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Imagemagick ignores all memory limits

Post by magick »

Resource limits only apply to ImageMagick, not to any of the delegate programs or libraries (e.g. Ghostscript). Memory, map, and disk limits generally only apply to the ImageMagick pixel cache, although a few algorithms also checks memory and memory map limits before internal buffers are allocated (e.g. -despeckle). See http://www.imagemagick.org/script/archi ... .php#cache. For large PDF's, set your memory and map limits to 2GB and force the PDF pages to disk. Again, this limits memory consumption in ImageMagick, not Ghostscript, the required delegate library to interpret PDF pages.
Post Reply