[PHP-DEV] PHP 4.0 Bug #5620: Memory leaks with classes and references to objects From: h.raaf <email protected>
Date: 07/15/00

From: h.raaf <email protected>
Operating system: Linux
PHP version: 4.0.1pl2
PHP Bug Type: Scripting Engine problem
Bug description: Memory leaks with classes and references to objects

While working on my current project I run into
the following memory leak problem:

class A {
        var $Bref=0;

        function CreateB() {
                $ob=new B;
                $this->Bref=&$ob;
                $this->Bref->Aref=&$this;
        }
}

class B {
        var $Aref=0;
}

$oa=new A;
$oa->CreateB();

--- Results in:

./zend_execute.c(392) : Freeing 0x085D570C (12 bytes), script=/var/www/users/test8/www/classleak.php
Last leak repeated 1 time
zend_hash.c(271) : Freeing 0x085422A4 (40 bytes), script=/var/www/users/test8/www/classleak.php
Last leak repeated 1 time
zend_hash.c(200) : Freeing 0x088E6614 (20 bytes), script=/var/www/users/test8/www/classleak.php
Last leak repeated 1 time
./zend_execute.c(1895) : Freeing 0x085478E4 (48 bytes), script=/var/www/users/test8/www/classleak.php
zend_API.c(208) : Actual location (location was relayed)
Last leak repeated 1 time

------

My real project code (a HRXSLT) generates
many, many more of this leaks...

I just tried to make the shortest program
which illustrates the problem.

Greetings,
 Hans Raaf

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>