#32403 [Opn->Fbk]: PHP does not free memory, occupied by cross-referencing objects
| From: | sniper@php.net | Date: | Fri, 25 Mar 2005 01:01:41 +0000 |
| Subject: | #32403 [Opn->Fbk]: PHP does not free memory, occupied by cross-referencing objects | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-75842@lists.php.net to get a copy of this message | ||
ID: 32403
Updated by: sniper@php.net
Reported By: valyala at tut dot by
-Status: Open
+Status: Feedback
Bug Type: Zend Engine 2 problem
Operating System: any
-PHP Version: Irrelevant
+PHP Version: 5x
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php5-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5-win32-latest.zip
As you were very clever and left all the PHP version information open
(there is no such PHP version as 'Irrelevant'), we now have no idea on
what version you experienced this with first. So try the snapshot.
Previous Comments:
------------------------------------------------------------------------
[2005-03-21 22:41:22] valyala at tut dot by
Description:
------------
See reproducible code below
Reproduce code:
---------------
<?
/**
cross-referencing memory leak.
PHP garbage collector doesn't free memory for
cross-referencing objects. It could be great
problem for daemons or services, written on PHP
*/
function memleak($size)
{
$a = str_repeat('a', $size);
// construct child
$child = array(
'data' => $a,
);
// construct parent
$parent = array(
'data' => $a,
'child' => &$child,
);
// comment following line to prevent memleak
$child['parent'] = &$parent;
}
// try to leak of 1GB memory
for ($i = 0; $i < 1000; $i++) memleak(1000000);
sleep(10);
?>
Expected result:
----------------
normal execution of script
Actual result:
--------------
PHP occupies all available memory.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=32403&edit=1