From:             
Operating system: Fedora 12
PHP version:      5.3.3
Package:          Class/Object related
Bug Type:         Bug
Bug description:Recursive References Leak Memory

Description:
------------
The behavior originally reported in #33595 still exists, namely, "Objects
with recursive references leak memory."

Test script:
---------------
class A {

    function __construct () {

        $this->b = new B($this);

    }

}



class B {

    function __construct ($parent = NULL) {

        $this->parent = $parent;

    }

}



echo memory_get_usage() . "\n";



for ($i = 0 ; $i < 1000000 ; $i++) {

    $a = new A();

}



echo memory_get_usage() . "\n";

Expected result:
----------------
Memory usage should remain relatively constant. For example, if you change
the one line to:

"$this->parent = clone $parent;"



Then the output is:

632216

632392

Actual result:
--------------
Memory usage increases with each newly instantiated object.



Actual output:

631976

1756792



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

Reply via email to