Re: Leaking references

From: Date: Wed, 28 Mar 2001 13:03:25 +0000
Subject: Re: Leaking references
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-50123@lists.php.net to get a copy of this message
I don't have enough mental strength to dive into that script right now, but be advised that if you create circular references (which apparently you do) then yes, it will leak. PHP doesn't support circular references. Zeev At 15:06 28/3/2001, Wez Furlong wrote:
[I can't reach the PHP web site (100% packet loss), so I can't open a bug report at this time] I have found a leak in the Zend engine: class A {
        var $t = null;
        function &run(&$t)
        {
                $this->t = &$t;
                return $this->t->run();
        }
} class C {
        var $obj = null;
        function &load_and_run()
        {
                $this->obj = & new A;
                return $this->obj->run($this);
        }
        function &run()
        {
                return "";
        }
} function &load_it() {
        $t =& new C;
        echo $t->load_and_run();
} echo load_it(); Running this script yields: zend_hash.c(291) : Freeing 0x0818E474 (37 bytes), script=leak.php Last leak repeated 1 time zend_hash.c(202) : Freeing 0x08193D1C (20 bytes), script=leak.php Last leak repeated 1 time ./zend_execute.c(1848) : Freeing 0x0818E414 (48 bytes), script=leak.php zend_API.c(208) : Actual location (location was relayed) Last leak repeated 1 time ./zend_execute.c(1847) : Freeing 0x08193F3C (12 bytes), script=leak.php Last leak repeated 1 time I know the script looks odd - it's part of a complex script that dynamically includes scripts to load classes. You get more leaks if you add more member variables to class A. I would guess that something (possibly the instance of class A) is not being freed/released somewhere that it should. --Wez. PS: If one of you guys could put this in the bug DB under my name, I would appreciate it. -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net For additional commands, e-mail: php-dev-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net
-- Zeev Suraski <zeev@zend.com> CTO & co-founder, Zend Technologies Ltd. http://www.zend.com/

« previous php.dev (#50123) next »