From:             [EMAIL PROTECTED]
Operating system: RedHat 7.2
PHP version:      4.3.0
PHP Bug Type:     Scripting Engine problem
Bug description:  Memory leak with references in objects

/*
If you don't set the UP property,
garbage collection is done in real time

If you set the UP property,
garbage collection is done on script shutdown only
and the VmSize increase.

This is a test case
but if a sub-object (in some package) creates a 
circular reference with a sub-sub-object you leak 
memory without the knowledge of it.
*/
for($i=1;$i<=$nb_loop;$i++){
        echo "<br>loop $i";
        flush();
        for($j=1;$j<=$nb_by_loop;$j++){
                $a=&new A(500);
                $a->b=&new B(500);
                $a->b->UP=&$a; // Memory Leak here
//              unset($a->b->up);
        }
        sleep($sleep_by_loop);
}

-- 
Edit bug report at http://bugs.php.net/?id=22055&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=22055&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=22055&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=22055&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=22055&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=22055&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=22055&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=22055&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=22055&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=22055&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=22055&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=22055&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=22055&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=22055&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=22055&r=gnused

Reply via email to