php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #44704 Imagecreate Eating up ram
Submitted: 2008-04-11 19:45 UTC Modified: 2008-04-20 01:00 UTC
From: dnncampbell1 at charter dot net Assigned:
Status: No Feedback Package: GD related
PHP Version: 5.2.5 OS: Windows XP Home
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: dnncampbell1 at charter dot net
New email:
PHP Version: OS:

 

 [2008-04-11 19:45 UTC] 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.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-04-20 01:00 UTC] php-bugs at lists dot php dot net
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".
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Feb 05 17:01:30 2025 UTC