#44636 [NoF->Csd]: class_exists() memory leak
| From: | bigtree at 29a dot nl | Date: | Tue, 15 Apr 2008 07:09:32 +0000 |
| Subject: | #44636 [NoF->Csd]: class_exists() memory leak | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-124245@lists.php.net to get a copy of this message | ||
ID: 44636
User updated by: bigtree at 29a dot nl
Reported By: bigtree at 29a dot nl
-Status: No Feedback
+Status: Closed
Bug Type: Class/Object related
Operating System: FreeBSD 6.1-RELEASE-p10
PHP Version: 5.2.5
New Comment:
Tried this on a different machine with same OS + PHP version. The bug
does not occur there. I assume a rebuild will help.
Previous Comments:
------------------------------------------------------------------------
[2008-04-12 01:00:00] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
------------------------------------------------------------------------
[2008-04-04 10:16:02] felipe@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows (zip):
http://snaps.php.net/win32/php5.2-win32-latest.zip
For Windows (installer):
http://snaps.php.net/win32/php5.2-win32-installer-latest.msi
------------------------------------------------------------------------
[2008-04-04 10:09:50] bigtree at 29a dot nl
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 this bug report at http://bugs.php.net/?id=44636&edit=1