#41411 [NEW]: imagecreatetruecolor memory break?
| From: | eth at ethaniel dot com | Date: | Wed, 16 May 2007 17:54:24 +0000 |
| Subject: | #41411 [NEW]: imagecreatetruecolor memory break? | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-112714@lists.php.net to get a copy of this message | ||
From: eth at ethaniel dot com
Operating system: Linux FC 6 2.6.18
PHP version: 5.2.2
PHP Bug Type: GD related
Bug description: imagecreatetruecolor memory break?
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 bug report at http://bugs.php.net/?id=41411&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=41411&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=41411&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=41411&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=41411&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=41411&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=41411&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=41411&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=41411&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=41411&r=support
Expected behavior: http://bugs.php.net/fix.php?id=41411&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=41411&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=41411&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=41411&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41411&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=41411&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=41411&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=41411&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=41411&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=41411&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=41411&r=mysqlcfg