I have a large gif file (about 15M) which requires more memory than the resource limit setting in policy.xml. So an exception is thrown when processing this file. After that the memory allocated by magick is not released as expected. The policy.xml, c++ code, compile script and sample image can be downloaded here. https://www.dropbox.com/sh/3esh3go7x19j ... memory.zip
following is code snip
Code: Select all
int main(int argc, const char* argv[]) {
if (argc != 2) {
printf("usage: %s /path/to/image/file\n", argv[0]);
return 0;
}
MagickCore::ResourceComponentGenesis();
{
std::string data;
if (!PrepareImageData(argv[1], data)) {
return 0;
}
// process image
foo(data);
// when goes to this line,
// memory is expected to have been released
// but that's not the fact.
int ttt = 0;
}
return 0;
}