Edit report at http://bugs.php.net/bug.php?id=52497&edit=1
ID: 52497 Updated by: johan...@php.net Reported by: tecnico at adam-italia dot it Summary: Memory Leak in classes cycle reference -Status: Open +Status: Bogus Type: Bug Package: *General Issues Operating System: CentsOS PHP Version: 5.2.14 Block user comment: N New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Use 5.3. Previous Comments: ------------------------------------------------------------------------ [2010-07-30 09:53:24] tecnico at adam-italia dot it Description: ------------ Memory Leak in classes cycle reference Test script: --------------- class foo { protected $mBar=null; public function setBar(bar $value){ $this->mBar=$value; } public function __destruct(){ unset($this->mBar); } } class bar { protected $mFoo=null; protected $mContent=null; public function __construct() { $this->mContent=str_repeat("prova",10000); } public function setFoo(foo $value){ $this->mFoo=$value; } public function __destruct(){ unset($this->mFoo); } } ini_set("memory_limit","32M"); $cont=0; while($cont<1000){ $cont++; $tmp_foo=new Foo(); $tmp_bar= new Bar(); $tmp_foo->setBar($tmp_bar); $tmp_bar->setFoo($tmp_foo); unset($tmp_foo, $tmp_bar); } Expected result: ---------------- no mem leak Actual result: -------------- Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 50001 bytes) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=52497&edit=1