ID: 29558 Updated by: [EMAIL PROTECTED] Reported By: zsheran at yahoo dot com -Status: Feedback +Status: No Feedback Bug Type: GD related Operating System: Redhat 9 PHP Version: 4.3.7 New Comment:
No feedback was provided for this bug for over a week, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open". Previous Comments: ------------------------------------------------------------------------ [2004-11-19 13:46:48] [EMAIL PROTECTED] Are you talking about real memory leaks (memory not freed at the end of the process) or about the memory used by php? --Pierre ------------------------------------------------------------------------ [2004-08-10 10:09:46] klaus at deam dot org maybe this is related to bug #29460? ------------------------------------------------------------------------ [2004-08-08 05:34:47] zsheran at yahoo dot com Thanks smacvicar. I made the following change at the bottom of the function: replaced unset($source_picture); unset($target_picture); with imagedestroy($source_picture); imagedestroy($target_picture); The problem persists. It still leaks memory the same way it did before. I didn't know imagedestroy() had to be used instead of unset(); my fault. But now it looks even more like a bug to me... ------------------------------------------------------------------------ [2004-08-07 04:43:35] smacvicar at gmail dot com http://uk.php.net/manual/en/function.imagedestroy.php ------------------------------------------------------------------------ [2004-08-07 00:14:14] zsheran at yahoo dot com Description: ------------ I call the function below from a loop about 17,000 times to resize JPGs which are about 20k each. Note that $source_file is a URL. I run the script from CLI. By the time the script finishes after ~270 minutes, the PHP process uses 340MB of RAM; it grows slowly and steadily to that size. I unset the variables at the end of the function but it makes no difference. Now 340MB is about the size of those 17,000 pics. For some reason, the fetched images are not freed from memory, probaly only upon finishing the script. But since it runs in a loop, it adds up at becomes eventually a problem. It works but it would be great if the memory leak could be fixed; I expect the number of images to grow to six digit numbers in the future. Thanks for your time. Reproduce code: --------------- function resize_picture ($source_file, $target_file) { $source_picture = imageCreateFromJPEG($source_file); if ($source_picture) { $picsize = @getimagesize($source_file); // get source image size $source_x = $picsize[0]; // source image width $source_y = $picsize[1]; // source image height #create image $target_picture $target_picture = imagecreatetruecolor(320, 240); #Resize $source_picture and copy it into $target_picture. imagecopyresampled($target_picture,$source_picture,0,0,0,0,320,240,$source_x,$source_y); #Create jpeg from $target_picture. Save as $target_file imagejpeg ($target_picture,"/path/$target_file",80); unset($source_picture); unset($target_picture); } } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=29558&edit=1