Leak in latest CVS using nested objects!
| From: | thies at digicol dot de | Date: | Tue, 18 Apr 2000 12:05:29 +0000 |
| Subject: | Leak in latest CVS using nested objects! | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-13664@lists.php.net to get a copy of this message | ||
hi,
just got this script of a colleague which shows some leakage
in Zend.
<?php
//
// Problem suggestion:
// If You enter class A via a cfunction class B
// $this refcons count in scope of class B ?!?!
//
class A
{ var $a = "AAAAAAAAAA\n";
var $b;
cfunction aa($parent)
{ $this->b = $parent;
echo $this->a;
}
}
class B
{ var $a;
var $b = "BBBBBBBBBB\n";
cfunction bb()
{ $this->a = new A();
// this one leaks
$this->a->aa($this);
// this one does not
$help = $this->a;
$help->aa($this);
echo $this->b;
}
}
$b = new B();
$b->bb();
?>
X-Powered-By: PHP/4.0RC2-dev
Content-type: text/html
AAAAAAAAAA
AAAAAAAAAA
BBBBBBBBBB
./../php4/Zend/zend_hash.c(255) : Freeing 0x08182F44 (37 bytes), script=ref
Last leak repeated 3 times
./../php4/Zend/zend_hash.c(185) : Freeing 0x08182EAC (20 bytes), script=ref
Last leak repeated 1 time
./../php4/Zend/zend_execute.c(405) : Freeing 0x08182E4C (48 bytes), script=ref
./../php4/Zend/zend_variables.c(147) : Actual location (location was relayed)
./../php4/Zend/zend_execute.c(402) : Freeing 0x08182E14 (12 bytes), script=ref
./../php4/Zend/zend_execute.c(1913) : Freeing 0x0818280C (48 bytes), script=ref
./../php4/Zend/zend_API.c(209) : Actual location (location was relayed)
./../php4/Zend/zend_execute.c(413) : Freeing 0x0817D54C (12 bytes), script=ref
./../php4/Zend/zend_compile.c(1548) : Freeing 0x08187FE4 (12 bytes), script=ref
Last leak repeated 1 time
./../php4/Zend/zend-scanner.l(1337) : Freeing 0x08187FA4 (13 bytes), script=ref
Last leak repeated 1 time
any suggestions?
BTW: even if i change to:
....
cfunction aa(&$parent)
{ $this->b = &$parent;
....
i still get leaks.
tc