Page 1 of 1

MemoryAllocationFailed with convert -distort IM 6.6.5-1 Q16

Posted: 2010-10-22T14:05:30-07:00
by leemyongpak
Hi
I use PHP to execute IM 6.6.5-1 Q16 convert command, it runs well with other options except -distort, even with the most simple SRT 0 parameter:

Code: Select all

print exec("convert beaver.jpg -distort SRT 0  beaver_d.jpg 2>&1");
exec("convert beaver.jpg -thumbnail 200  beaver_thumb.jpg");
The first line usually failed with several kinds of MemoryAlocationFailed:

Code: Select all

convert: MemoryAllocationFailed `' @ fatal/locale.c/LoadLocaleList/923.
convert: Memory allocation failed `' @ fatal/cache.c/AcquirePixelCacheNexus/260.
convert: UnableToAcquireString `' @ fatal/string.c/ConstantString/641.
while the second passed.
My host provider tell me this is the memory leak error caused by my PHP code, but I only have above 2 lines of code in my test script
and nobody access my site during testing time so how can PHP causes this Memory Leak situation?
You can check my IM configuration at http://funphoto.it/choisy/test_config.php and
MemoryAllocationFailed error at http://funphoto.it/choisy/test_cubo.php (refresh several time you will see some time it passed but most of time failed)
Please tell me this is an IM memory leak bug or a PHP bug.
Thanks.

Re: MemoryAllocationFailed with convert -distort IM 6.6.5-1

Posted: 2010-10-22T16:53:13-07:00
by magick
Add -limit area 0 before your image file name on the convert command line.

Re: MemoryAllocationFailed with convert -distort IM 6.6.5-1

Posted: 2010-10-22T18:03:03-07:00
by leemyongpak
Adding -limit area 0 help a bit, there is only one error message:

Code: Select all

convert: Memory allocation failed `' @ fatal/cache.c/AcquirePixelCacheNexus/260. 
instead of several before.
And it still runs unstably: sometime passed, sometime failed.
Memory leak bug seem follow Imagemagick along it's life :(

Re: MemoryAllocationFailed with convert -distort IM 6.6.5-1

Posted: 2010-10-22T18:14:48-07:00
by magick
The problem is not a memory leak. ImageMagick is requesting memory and your system is refusing to honor the request. Its possible the system limits memory or stack (see ulimit) and ImageMagick cannot complete its task. Add -debug all to your command line to track where ImageMagick fails.

Re: MemoryAllocationFailed with convert -distort IM 6.6.5-1

Posted: 2010-10-22T21:16:52-07:00
by leemyongpak
With current PHP test code

Code: Select all

@unlink('beaver_d.jpg');
	print exec("convert -debug all -limit area 0 beaver.jpg -distort SRT 0  beaver_d.jpg 2>&1");

It return IM tmp file name when passed and beaver.jpg with a formular when failed :

Code: Select all

passed: 
	/tmp/magick-XXGMYcms
	/tmp/magick-XX7wbkMo
	/tmp/magick-XXSj850a
---------------------------------------
failed:
	beaver.jpg[0][5x1+98+18]
	beaver.jpg[0][5x1+25+57]
	beaver.jpg[0][5x1+50+60]
What can I do next?
Thanks for your help.

Re: MemoryAllocationFailed with convert -distort IM 6.6.5-1

Posted: 2010-11-09T04:13:19-07:00
by leemyongpak
Finally I transfer my site to other host with older Imagemagick version (6.4.8) and all bugs disappear.
With Imagemagick the newest version is not always the best :)

Re: MemoryAllocationFailed with convert -distort IM 6.6.5-1

Posted: 2010-11-09T18:48:32-07:00
by anthony
More likely the machine itself and what processes the machine is running caused the program to work on the other machine. Not the change in ImageMagick.

Try installing a newer version (perhaps as a 'personal install'), as see if the problem returned!

See http://www.ict.griffith.edu.au/~anthony ... gick.hints