php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22293 Memory leak when creating reference to $this
Submitted: 2003-02-19 04:18 UTC Modified: 2003-02-19 04:24 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: christian at shockwaved dot com Assigned:
Status: Closed Package: Class/Object related
PHP Version: 4.2.3 OS: FreeBSD
Private report: No CVE-ID: None
 [2003-02-19 04:18 UTC] christian at shockwaved dot com
We have gone through some testing and found that PHP leaks quite some ressources when creating references to $this. Here's an example script:

<?php

class foo {

    var $me;

    function foo() {
	$this->me = &$this;
    }

}

while ($i++ < 100000) { 
    $bar = new foo();
    unset($bar);
}

sleep(42);

?>

Can we do anything else to provide you with means to solve this problem?

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-02-19 04:24 UTC] derick@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.

Is fixed in PHP-5-dev...
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 11 17:01:35 2024 UTC