From: jim dot keller at contextsolutions dot net
Operating system: Windows XP
PHP version: 5.2.6
PHP Bug Type: Performance problem
Bug description: ReflectionObject memory leak
Description:
------------
when a reflector is stored in a class property, the reflector appears to
stay in memory after the object is destroyed. This could be related to
#33595
Reproduce code:
---------------
class testclass {
protected $_r;
public function __construct() {
$this->getr();
}
public function getr() {
if ( !$this->_r ) $this->_r = new ReflectionObject($this);
return $this->_r;
}
}
for ( $j = 0; $j < 100; $j++ ) {
$t = new testclass();
echo memory_get_usage() . '<br />';
}
Expected result:
----------------
memory usage should stay constant
Actual result:
--------------
memory usage increases with every iteration
--
Edit bug report at http://bugs.php.net/?id=46103&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=46103&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=46103&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=46103&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=46103&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=46103&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=46103&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=46103&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=46103&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=46103&r=support
Expected behavior: http://bugs.php.net/fix.php?id=46103&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=46103&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=46103&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=46103&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=46103&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=46103&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=46103&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=46103&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=46103&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=46103&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=46103&r=mysqlcfg