Convert uses too much memory
Posted: 2013-07-17T02:49:33-07:00
I have 3 servers. All of them Debian + nginx+ php5-fpm + imagemagick. I installed Imagemagick using the commant apt-get install imagemagick.
All 3 servers have the same problem. From time to time I get emails from all servers with warnings about excessive resource usage.
My users upload hundreds of jpg images every day and the maximum allowed file size is 4 MB. Warning emails I receive maybe2-10 times per day but I think it's not normal that Imagemagick sometimes needs 386 MB and more memory to resize one jpg image < 4 MB.
What do you suggest to limit memory usage? What is the correct way to do this? Like this:
Is this correct? Should I leave 32 MiB and 64 Mib as it is?
Thanks.
All 3 servers have the same problem. From time to time I get emails from all servers with warnings about excessive resource usage.
Code: Select all
Time: Tue Jul 16 17:02:18 2013 +0000
Account: www-data
Resource: Virtual Memory Size
Exceeded: 386 > 200 (MB)
Executable: /usr/bin/convert
Command Line: convert -geometry 800x532 /home/site2/pics/16745fgtr543hdt.jpg /home/site2/pics/16745fgtr543hdt.jpg
PID: 2302 (Parent PID:2301)
Killed: No
What do you suggest to limit memory usage? What is the correct way to do this? Like this:
Code: Select all
exec("convert -geometry -limit memory 32MiB -limit map 64MiB \"".$width1."x".$height1."\" \"$upfile\" \"$upfile\"");
Thanks.