From: dnncampbell1 at charter dot net
Operating system: Windows XP Home
PHP version: 5.2.5
PHP Bug Type: *Graphics related
Bug description: Imagecreate Eating up ram
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 bug report at http://bugs.php.net/?id=44704&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=44704&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=44704&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=44704&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=44704&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=44704&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=44704&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=44704&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=44704&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=44704&r=support
Expected behavior: http://bugs.php.net/fix.php?id=44704&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=44704&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=44704&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=44704&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=44704&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=44704&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=44704&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=44704&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=44704&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=44704&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=44704&r=mysqlcfg