Undue memory usage

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
broucaries
Posts: 467
Joined: 2008-12-21T11:51:10-07:00

Undue memory usage

Post by broucaries »

It seems that this imagemagick is not displayed by imagemagick and use more than 4G of disk.

https://bugs.launchpad.net/ubuntu/+sour ... bug/704531
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Undue memory usage

Post by magick »

ImageMagick is behaving properly. The zzzbad1.jpeg image is 26400x20400 pixels and as described in the architecture document @ http://www.imagemagick.org/script/architecture.php, image pixels are sometimes cached to disk if memory resources are consumed. The user could try increasing the area limit which might permit the image to be processed in memory:
  • export MAGICK_AREA_LIMIT=12gb
    convert zzzbad1.jpeg zzzbad1.png
You can also reduce the memory requirements significantly if you use the Q8 (8-bits per pixel) version of ImageMagick instead of the default Q16 build.

We were able to convert the image from JPEG to PNM in memory on our 4GB Fedora host in just under 20 seconds.

Now displaying is a different beast. ImageMagick asks libX11 for a 26400x20400 pixmap and it may have trouble allocating the memory. You could force ImageMagick to cache the pixels to disk which permits libX11 to allocate the remaining real / virtual memory:
  • display -limit area 0 zzzbad1.jpg
This failed gracefully for us on our 8GB Linux host with an X11 exception:
  • display -limit area 0 zzzbad1.jpeg
    XIO: fatal IO error 14 (Bad address) on X server ":0"
    after 11687 requests (1482 known processed) with 36 events remaining.
However, this worked:
  • display -limit area 0 -resize 50% zzzbad1.jpeg
Post Reply