php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38505 Reopen bug #26982
Submitted: 2006-08-18 22:04 UTC Modified: 2006-08-21 08:25 UTC
From: trevan at therichins dot net Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.1.5 OS: Debian sid (linux kernel 2.4.29)
Private report: No CVE-ID: None
 [2006-08-18 22:04 UTC] trevan at therichins dot net
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.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-08-21 08:25 UTC] tony2001@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 23 18:00:02 2025 UTC