Bug #55228 [Opn->Dup]: Objects cannot be collected if they extends some spl classes
| From: | cataphract@php.net | Date: | Fri, 22 Jul 2011 08:43:19 +0000 |
| Subject: | Bug #55228 [Opn->Dup]: Objects cannot be collected if they extends some spl classes | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-162095@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=55228&edit=1
ID: 55228
Updated by: cataphract@php.net
Reported by: cofyc dot jackson at gmail dot com
Summary: Objects cannot be collected if they extends some spl
classes
-Status: Open
+Status: Duplicate
Type: Bug
Package: SPL related
Operating System: Mac OS X
PHP Version: 5.3.6
Block user comment: N
Private report: N
New Comment:
Duplicate of bug #53803.
Previous Comments:
------------------------------------------------------------------------
[2011-07-18 07:31:08] cofyc dot jackson at gmail dot com
Description:
------------
If objects' classes extends ArrayIterator/ArrayObject, and recursively refer to
each other, they will not be garbage collected.
I tried reproduction code in https://bugs.php.net/bug.php?id=33595, modified A
to
extend ArrayIterator, B to extend ArrayObject.
And is there a way to work around it currently?
Test script:
---------------
<?php
class A extends ArrayIterator {
function __construct () {
$this->b = new B($this);
}
}
class B extends ArrayObject {
function __construct ($parent = NULL) {
$this->parent = $parent;
}
}
for ($i = 0 ; $i < 1000000 ; $i++) {
$a = new A();
printf("gc: %d, %f\n", gc_collect_cycles(), memory_get_usage()/1024/1024);
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=55228&edit=1