Page 1 of 1

Undue memory usage

Posted: 2011-10-11T06:05:46-07:00
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

Re: Undue memory usage

Posted: 2011-10-11T06:47:07-07:00
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