This project has moved. For the latest updates, please go here.

Memory allocation failed

May 22, 2015 at 3:21 PM
Hello,

Several times I got the following error message:

Thumbnailer failed with exception: 2BAB.exe: Memory allocation failed `e:\temp\QProcess\dffda8d0-dd21-49df-8a3b-132fb6df7088\logo_sds_max.gif' @ error/gif.c/WriteGIFImage/1631; Uri: logo_sds_max.jpg

This is not consequent. Sometimes other images fail.
Can this be a memory leak or is there something wrong with the imput message?

The used code:
using (var image = new MagickImage(this.source))
                {
                    image.Thumbnail(this.width, this.height);
                    image.Extent(this.width, this.height, Gravity.Center, MagickColor.Transparent);
                    image.Write(this.destination);
                }
_Where width and height are 200 and destionation xyz.gif _

We are using the x86 8bpp version. The input file:
Image
Coordinator
May 23, 2015 at 7:47 AM
This error is kind of strange but you are getting this exception because ImageMagick was unable to reduce the number of colors to 256. But I cannot reproduce the issue with your image. Are you using the latest version?
May 26, 2015 at 6:52 AM
We are using the latest version. The problem is that it is not consequent. We are converting (thumbnailing) huge sets of images... Can it be a real memory problem?
Coordinator
May 26, 2015 at 9:31 PM
It looks like reducing the number of colors only fails when there is a memory issue. Maybe you are processing to many images at the same time?
May 28, 2015 at 7:34 PM
We are running with max 16 threads simultaneously on Windows Server 2008. Normally we have about 3 GB ram free (10% of the 32GB physical ram).
Coordinator
May 29, 2015 at 2:58 PM
It really depends on the size of your image but it can take up a big amount of memory really fast. If only 3 GB is available for ImageMagick you might want to limit the memory usage to 2GB and use 'disk memory' for the rest. But that will really hurt the performance of your application. You can do that with: ResourceLimits.Memory.