PHP memory leak when working with image

I have a bad time trying to work with an image with PHP. The image is good ... big. This is a high definition image (36MP resolution) for a total size of 23Mo.

I do certain things in this picture, for example, changing its size or transforming it into shades of gray.

The problem is that when I look at memory usage with htop on the terminal, I see that apache uses memory (just over 140 MB), but does not free it when image processing is complete.

I removed each image processing function one at a time and now I have only these 3 simple lines, but the leak still exists:

$image = imagecreatefromstring( file_get_contents($imageFullPath) );
imagedestroy($image);
unset($image);

Does anyone have any ideas why?

Thanks!

Jim

+4
1

php. unset ($ image) , . , .

$image = NULL;
0

Source: https://habr.com/ru/post/1623398/


All Articles