#36847 [Opn->Bgs]: debug_backtrace() result is not unset and eats memory

From: Date: Wed, 12 Apr 2006 11:58:42 +0000
Subject: #36847 [Opn->Bgs]: debug_backtrace() result is not unset and eats memory
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-95666@lists.php.net to get a copy of this message
ID: 36847 Updated by: dmitry@php.net Reported By: toggg@php.net -Status: Open +Status: Bogus Bug Type: Scripting Engine problem Operating System: fc3 PHP Version: 5CVS-2006-03-24 (snap) -Assigned To: +Assigned To: dmitry New Comment: Backtrace information that is returned from debug_backtrace() contains reference to $this object. So this examle creates circular data structure. PHP cannot free circular structures at runtime and does free them on request shutdown. So this bug is the same as bug #33595 (recursive references leak memory). Previous Comments: ------------------------------------------------------------------------ [2006-03-26 06:09:54] toggg@php.net This not the same situation as #33487 Here, it's not a question of local variable within a method. And we actually unset the created object. If I do the same with $this->backtrace = str_pad(' ', 2300); then the memory is not eaten up. This occurs only if debug_backtrace() result is affected to a property of the test object. ------------------------------------------------------------------------ [2006-03-26 01:03:57] tony2001@php.net Duplicate of bug #33487. ------------------------------------------------------------------------ [2006-03-24 16:56:03] toggg@php.net Description: ------------ It was originated by http://pear.php.net/bugs/bug.php?id=6788 Reproduce code: --------------- <?php class test { var $backtrace = null; function test() { $this->backtrace = debug_backtrace(); } } set_time_limit(0); for($i = 0; $i <= 10000; $i++) { $ret = &new test(); unset($ret); } ?> Expected result: ---------------- nothing Actual result: -------------- memory exhausted ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=36847&edit=1

« previous php.bugs (#95666) next »