|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2010-08-01 21:17 UTC] johannes@php.net
-Status: Open
+Status: Bogus
[2010-08-01 21:17 UTC] johannes@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 20:00:01 2025 UTC |
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)