Stack overflow resizing many images

Magick++ is an object-oriented C++ interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick++.
Post Reply
jhelm
Posts: 1
Joined: 2011-10-12T12:49:57-07:00
Authentication code: 8675308

Stack overflow resizing many images

Post by jhelm »

I'm running into a stack overflow using Magick++ within a native Visual C++ application (NT service). The crash occurs when I attempt to resize a large number of images (hundreds to thousands), one after another. Eventually, the process crashes with a stack overflow at the first line of the code below. I tried both using new/delete instead as well as static vs dynamic linking, they all seems to end up eventually crashing with a stack overflow.

The code in use is:

Code: Select all

try
{
	Magick::Image img(Magick::Blob(cacheImage->data, cacheImage->size));
	img.scale(Magick::Geometry(width, height));
	Magick::Blob blob;
	img.write(&blob);
	size = blob.length();
	*data = (uint8_t*)memdup(blob.data(), size);
}
catch(Magick::Exception& e)
{
	eprintf("Magick++ threw exception: %hs", e.what());
}
The code above is /not/ called within a loop, it's a function that's called repeatedly by a client continuing to make requests. This is Visual C++ 10 (Visual Studio 2010) and both the application and ImageMagick are built with it (I'm building ImageMagick myself using VisualMagick). The application is running as a Windows service and links with Ole32.lib;Advapi32.lib;BugTrapU.lib;libxml2.lib;CORE_DB_Magick++_.lib.

Any help would be appreciated.
- Josh
Post Reply