#44636 [NEW]: class_exists() memory leak
| From: | bigtree at 29a dot nl | Date: | Fri, 04 Apr 2008 10:09:50 +0000 |
| Subject: | #44636 [NEW]: class_exists() memory leak | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-123954@lists.php.net to get a copy of this message | ||
From: bigtree at 29a dot nl
Operating system: FreeBSD 6.1-RELEASE-p10
PHP version: 5.2.5
PHP Bug Type: Class/Object related
Bug description: class_exists() memory leak
Description:
------------
When implicitely casting class_exists() to a boolean, a memory leak
occurs. It does not matter if the given class exists or not.
Reproduce code:
---------------
for ($i = 1; $i < 100; $i++) {
if (class_exists('foo')) { }
echo memory_get_usage() . "\n";
}
Expected result:
----------------
A constant amount of memory (at least after the first iteratation)
Actual result:
--------------
A growing amount of used memory.
A workaround can be:
if ((boolean)class_exists('foo')) { }
or
$foo = class_exists('foo');
if ($foo) {}
in these cases the memory leak does not occur
--
Edit bug report at http://bugs.php.net/?id=44636&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=44636&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=44636&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=44636&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=44636&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=44636&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=44636&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=44636&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=44636&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=44636&r=support
Expected behavior: http://bugs.php.net/fix.php?id=44636&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=44636&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=44636&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=44636&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=44636&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=44636&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=44636&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=44636&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=44636&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=44636&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=44636&r=mysqlcfg