#37375 [NEW]: foreach memory leaks when work with try-catch
| From: | chen dot daqi at gmail dot com | Date: | Tue, 09 May 2006 06:08:24 +0000 |
| Subject: | #37375 [NEW]: foreach memory leaks when work with try-catch | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-96841@lists.php.net to get a copy of this message | ||
From: chen dot daqi at gmail dot com
Operating system: linux
PHP version: 6CVS-2006-05-09 (CVS)
PHP Bug Type: Unknown/Other Function
Bug description: foreach memory leaks when work with try-catch
Description:
------------
When a exception is throwed from a foreach, memory leak will happen
Reproduce code:
---------------
<?php
try{
$ar = array(1, 2, 3);
foreach($ar as $ele)
{
throw new Exception("new exception");
}
}
catch(Exception $e)
{
echo $e->getMessage()."\n";
}
?>
Expected result:
----------------
new exception
Actual result:
--------------
new exception
[Tue May 9 13:40:13 2006] Script: 'test.php'
/home/xlchen/php-5.1.2/Zend/zend_execute.c(843) : Freeing 0x0847FD5C (16
bytes)
, script=test.php
[Tue May 9 13:40:13 2006] Script: 'test.php'
/home/xlchen/php-5.1.2/Zend/zend_vm_execute.h(3370) : Freeing 0x0847FCAC
(35 by
tes), script=test.php
/home/xlchen/php-5.1.2/Zend/zend_hash.c(383) : Actual location (location
was rel
ayed)
Last leak repeated 2 times
[Tue May 9 13:40:13 2006] Script: 'test.php'
/home/xlchen/php-5.1.2/Zend/zend_vm_execute.h(3339) : Freeing 0x0846D054
(16 by
tes), script=test.php
Last leak repeated 2 times
[Tue May 9 13:40:13 2006] Script: 'test.php'
/home/xlchen/php-5.1.2/Zend/zend_vm_execute.h(3320) : Freeing 0x084809AC
(32 by
tes), script=test.php
/home/xlchen/php-5.1.2/Zend/zend_hash.c(169) : Actual location (location
was rel
ayed)
Last leak repeated 1 time
=== Total 9 memory leaks detected ===
--
Edit bug report at http://bugs.php.net/?id=37375&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=37375&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=37375&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=37375&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=37375&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=37375&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=37375&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=37375&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=37375&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=37375&r=support
Expected behavior: http://bugs.php.net/fix.php?id=37375&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=37375&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=37375&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=37375&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=37375&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=37375&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=37375&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=37375&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=37375&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=37375&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=37375&r=mysqlcfg