Page 1 of 1

Magick: memory allocation failed `imagePath' @ error/bmp.c/ReadBMPImage/941

Posted: 2018-01-10T18:54:49-07:00
by umair.xdoz
I am writing a c++ code and trying to crop an image. However, it fails at the initialisation after a few iterations.

The function is being called in a library inside a loop and it works fine a few times (twice).

Is there any way of deallocating the memory after operations have been performed on an image ?

My code is below:

Code: Select all

Image imageMagic(imagePath);
imageMagic.crop(Geometry(699, 150, 198, 625));
imageMagic.write(labelName);
is theer anything like image.dealloc or something which frees up the memory every time it has been used ?

Re: Magick: memory allocation failed `imagePath' @ error/bmp.c/ReadBMPImage/941

Posted: 2018-01-10T21:04:26-07:00
by snibgo
Your code doesn't have a loop.

My understanding is that Magick++ will automatically free memory (by "destructor") for an Image structure when it is no longer a valid reference. So the placement of what is inside or outside the loop is important.