#41411 [Opn]: imagecreatetruecolor memory break?
| From: | eth at ethaniel dot com | Date: | Wed, 16 May 2007 17:55:42 +0000 |
| Subject: | #41411 [Opn]: imagecreatetruecolor memory break? | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-112715@lists.php.net to get a copy of this message | ||
ID: 41411
User updated by: eth at ethaniel dot com
Reported By: eth at ethaniel dot com
Status: Open
Bug Type: GD related
Operating System: Linux FC 6 2.6.18
PHP Version: 5.2.2
New Comment:
Sorry, I messed up when submitting the bug report. Expected and Actual
results fields are to be switched places.
Previous Comments:
------------------------------------------------------------------------
[2007-05-16 17:54:24] eth at ethaniel dot com
Description:
------------
I run a image thumbnail service on my server, it runs under priority of
+11. It has a memory limit set to 520M.
On some images it exits with "Allowed memory size of 545259520 bytes
exhausted" when I do imagecreatetruecolor(500,375).
Memory usage details below.
Reproduce code:
---------------
if ($photo_id==2348804) error_log(memory_get_usage()." - $newX -
$newY");
$newImg = ImageCreateTrueColor($newX, $newY);
if ($photo_id==2348804) error_log(memory_get_usage()." - $newX -
$newY");
Expected result:
----------------
following entry in error log
[16-May-2007 19:10:27] 6451636 - 500 - 375
[16-May-2007 18:34:24] PHP Fatal error: Allowed memory size of
545259520 bytes exhausted (tried to allocate 2000 bytes) in
/data1/albums/retreive.php3 on line 427
Actual result:
--------------
I checked the memory usage right before imagecreatetruecolor and it was
at 6.4M. The memory limit was set to 512M, script run under nice +11.
It crashes on imagecreatetruecolor.
But when I set the memory limit to 10000M it works ok and the code
above returns.
[16-May-2007 19:10:27] 6451636 500 - 375
[16-May-2007 19:10:27] 7405476 500 - 375
As you can see, the real memory usage raised only about 1MB instead of
hitting the upper limit of 500MB.
This happened only on some images. Don't know why.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=41411&edit=1