Page 1 of 1

memory allocation failed

Posted: 2019-09-05T02:39:40-07:00
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.

Re: memory allocation failed

Posted: 2019-09-05T05:11:53-07:00
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.