MemoryAllocationFailed with convert -distort IM 6.6.5-1 Q16

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
leemyongpak

MemoryAllocationFailed with convert -distort IM 6.6.5-1 Q16

Post 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.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: MemoryAllocationFailed with convert -distort IM 6.6.5-1

Post by magick »

Add -limit area 0 before your image file name on the convert command line.
leemyongpak

Re: MemoryAllocationFailed with convert -distort IM 6.6.5-1

Post 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 :(
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: MemoryAllocationFailed with convert -distort IM 6.6.5-1

Post 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.
leemyongpak

Re: MemoryAllocationFailed with convert -distort IM 6.6.5-1

Post 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.
leemyongpak

Re: MemoryAllocationFailed with convert -distort IM 6.6.5-1

Post 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 :)
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: MemoryAllocationFailed with convert -distort IM 6.6.5-1

Post 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
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply