Leaking references

From: Date: Wed, 28 Mar 2001 13:06:36 +0000
Subject: Leaking references
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-50121@lists.php.net to get a copy of this message
[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.

« previous php.dev (#50121) next »