From: trevan at therichins dot net
Operating system: Debian sid (linux kernel 2.4.29)
PHP version: 5.1.5
PHP Bug Type: Scripting Engine problem
Bug description: Reopen bug #26982
Description:
------------
I discovered a memory leak in my script and so was looking through the
database to see if it was fixed in CVS. That brought me to bug #26982
which is identical to my problem. The answer given there was that it is
expected behaviour, but I don't quite understand why? I would have
expected the behaviour to have an increase in memory usage but than have
it stop after the garbage collector catches up. But, I am instead seeing
the memory constantly increase. This behaviour prevents PHP from being
used as a Linux service (which is what I am trying to do) as many php
libraries out there use this method to create strings.
Reproduce code:
---------------
<?php
$database = 'mysql';
while (1) {
$old = memory_get_usage();
"database_{$database}";
$new = memory_get_usage();
echo $new - $old;
echo "\n";
sleep(1);
}
?>
Expected result:
----------------
I would expect the memory to go up for a while and then stop as the
garbage collector catches up and cleans out the old strings.
Actual result:
--------------
It shows a constant increase of 16 bytes.
--
Edit bug report at http://bugs.php.net/?id=38505&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=38505&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=38505&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=38505&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=38505&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=38505&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=38505&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=38505&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=38505&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=38505&r=support
Expected behavior: http://bugs.php.net/fix.php?id=38505&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=38505&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=38505&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=38505&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=38505&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=38505&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=38505&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=38505&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=38505&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=38505&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=38505&r=mysqlcfg