From:             piotr dot banasik at gmail dot com
Operating system: Linux/os-x
PHP version:      5.3CVS-2009-01-28 (snap)
PHP Bug Type:     Class/Object related
Bug description:  recursive references are not garbage collected

Description:
------------
This appears to be the same issue as the now closed bug #33595

I originally experienced this with php 5.2, after googling around I
stumbled upon #33595. It looked like it fixed the issue, so I grabbed first
the alpha, and then the snapshot of 5.3, neither of them appear to have the
issue fixed.

I'm using the op's original test code and memory usage jumps from 329,956
bytes before, to 1,027,088 after the 1mil iterations. (In my actual way
more complex code this is causing ~20k per iteration memory jumps so its
very non trivial to me).

Reproduce code:
---------------
<?php
class A {
    function __construct () {
        $this->b = new B($this);
    }
}

class B {
    function __construct ($parent = NULL) {
        $this->parent = $parent;
    }
}

echo number_format(memory_get_usage()) . "\n";

for ($i = 0 ; $i < 1000000 ; $i++) {
    $a = new A();
}

echo number_format(memory_get_usage()) . "\n";

?>

Expected result:
----------------
the before and after memory usage should not go up by much

Actual result:
--------------
329,956
1,027,088

-- 
Edit bug report at http://bugs.php.net/?id=47233&edit=1
-- 
Try a CVS snapshot (PHP 5.2):        
http://bugs.php.net/fix.php?id=47233&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):        
http://bugs.php.net/fix.php?id=47233&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):        
http://bugs.php.net/fix.php?id=47233&r=trysnapshot60
Fixed in CVS:                        
http://bugs.php.net/fix.php?id=47233&r=fixedcvs
Fixed in CVS and need be documented: 
http://bugs.php.net/fix.php?id=47233&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=47233&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=47233&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=47233&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=47233&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=47233&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=47233&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=47233&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=47233&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=47233&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=47233&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=47233&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=47233&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=47233&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=47233&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=47233&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=47233&r=mysqlcfg

Reply via email to