#44704 [Opn->Fbk]: Imagecreate Eating up ram
| From: | jani@php.net | Date: | Sat, 12 Apr 2008 01:17:09 +0000 |
| Subject: | #44704 [Opn->Fbk]: Imagecreate Eating up ram | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-124168@lists.php.net to get a copy of this message | ||
ID: 44704
Updated by: jani@php.net
Reported By: dnncampbell1 at charter dot net
-Status: Open
+Status: Feedback
Bug Type: GD related
Operating System: Windows XP Home
PHP Version: 5.2.5
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows (zip):
http://snaps.php.net/win32/php5.2-win32-latest.zip
For Windows (installer):
http://snaps.php.net/win32/php5.2-win32-installer-latest.msi
Previous Comments:
------------------------------------------------------------------------
[2008-04-11 19:45:34] dnncampbell1 at charter dot net
Description:
------------
I have a resizeimage page taht I use to display intermediate size pics
on my viewer page. It resizes one image every time it is ran. After a
few hours apache is taking up like 600 meg of ram and the page will not
load anymore.
Reproduce code:
---------------
$dst_img = imagecreatetruecolor($dest_w, $dest_h);
imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $dest_w, $dest_h,
$srcsize[0], $srcsize[1]);
switch($srcsize['mime'])
{
case "image/jpeg":
header("content-type: image/jpeg");
imagejpeg($dst_img);
break;
case "image/png":
header("content-type: image/png");
imagepng($dst_img);
break;
case "image/gif":
header("content-type: image/gif");
imagegif($dst_img);
break;
}
// Destroy images
imagedestroy($src_img);
imagedestroy($dst_img);
Expected result:
----------------
That is part of the code. The beginning part opens the file and gets
the info about it to know which one to use. I would expect using
imagedestroy at the end for both images would remove it from memory.
Actual result:
--------------
Some memory is regained, but not all the time.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=44704&edit=1