Destroy method doesn't free resources
Posted: 2011-11-11T06:28:54-07:00
Hi
I have a problem when using imagick for resizing images.
The imagick wrapper works correctly, but I detected that the server's RAM increases to the maximum available.
It looks like the method 'destroy', responsible for releasing the resources associated with object 'imagick' not release these resources.
My process resize a lot of images like a for loop, and in each iteration, the memory decrease slowly and steadily.
The only way to free the memory used is to make a restart apache.
The code i use is:
$image = "http://foto-cache.elcomercio.es/jpg/0/8 ... 932680.jpg";
$imagick = new Imagick();
$imagick->readImage($image);
$imagick->scaleImage(300, 300);
$imagick->clear();
$imagick->destroy();
you can try it by doing a loop 'for ($i = 1; $i <= 1000; $i++)' of this code and looking the decrease of server's RAM with a 'top -d 1'
thanks a lot
I have a problem when using imagick for resizing images.
The imagick wrapper works correctly, but I detected that the server's RAM increases to the maximum available.
It looks like the method 'destroy', responsible for releasing the resources associated with object 'imagick' not release these resources.
My process resize a lot of images like a for loop, and in each iteration, the memory decrease slowly and steadily.
The only way to free the memory used is to make a restart apache.
The code i use is:
$image = "http://foto-cache.elcomercio.es/jpg/0/8 ... 932680.jpg";
$imagick = new Imagick();
$imagick->readImage($image);
$imagick->scaleImage(300, 300);
$imagick->clear();
$imagick->destroy();
you can try it by doing a loop 'for ($i = 1; $i <= 1000; $i++)' of this code and looking the decrease of server's RAM with a 'top -d 1'
thanks a lot