memory allocation failed

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
bernard.feldman
Posts: 1
Joined: 2019-09-05T02:35:39-07:00
Authentication code: 1152

memory allocation failed

Post by bernard.feldman »

Hi,
i inherited an old .net C# code that uses Magick. i needed to do a change in the code so i can compare images that are saved on the bucket as well as images saved locally.
for some reason, i now started to get errors of type memory allocation failed:
E

Code: Select all

xception: Type=MagickResourceLimitErrorException Message=memory allocation failed `\\op-images\d$....jpg' @ error/paint.c/FloodfillPaintImage/203
 at ImageMagick.MagickExceptionHelper:Check(IntPtr exception)
 at ImageMagick.MagickImage+NativeMagickImage:FloodFill(DrawingSettings settings, Int32 x, Int32 y, MagickColor target, Boolean invert)
 at ImageMagick.MagickImage:FloodFill(MagickColor color, Int32 x, Int32 y, MagickColor target, Boolean invert)
 at ImageMagick.MagickImage:FloodFill(MagickColor color, Int32 x, Int32 y, Boolean invert)
 at ImageMagick.MagickImage:FloodFill(MagickColor color, Int32 x, Int32 y)
 at CompareImagesWindowsService.ImageComplianceEngine:GetData(String filePath1, String filePath2, Decimal[] parameters, Tuple`2 imageSize, Byte[]& diffImage, String& categories, String& comments, Object[]& debugData) in D:\Home\UtilsCloud\Insights\CompareImagesWindowsService\ImageComplianceEngine.cs:line 442
 at CompareImagesLib.CompareImagesMechanism:CompareImages2(String filePath1, String filePath2, Decimal[] parameters, Tuple`2 imageSize, Byte[]& diffImage, String& categories, String& comments) in D:\Home\UtilsCloud\Insights\CompareImagesWindowsService\CompareImagesMechanism.cs:line 90
again, the change was done on my piece of code, but nothing that should affect the actual comparison. Can anyone help with this issue please, it effects my production!
It's not with every comparison, that's why it wasn't caught in QA, but with quite a lot.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: memory allocation failed

Post by snibgo »

bernard.feldman wrote:... i needed to do a change in the code ... i now started to get errors of type memory allocation failed
I suppose your change allocates memory, so there is less available for other processes. I suppose flood fill uses a stack in memory, and I expect that could be large.

If your memory allocation involves a pixel cache, perhaps you can limit the memory used so this is stored on disk. But that will create a performance penalty.
snibgo's IM pages: im.snibgo.com
Post Reply