Open GoogleCodeExporter opened 9 years ago
It seems like the problem is caused by circular references and is thus more of a
problem of PHP rather than the library code. It seems to be a known weakness of
reference counting schemes: http://bugs.php.net/bug.php?id=33595.
This can also be verified by commenting line 280 of Box.php that sets the parent
reference to all the child boxes. The memory stays constant having that line
commented.
I will keep the issue open until I come up with something for this. Thanks for
reporting!
Original comment by svollbehr
on 26 Apr 2009 at 5:10
The following code reproduces the problem:
{{{
class A {
private $parent = null;
private $childs = array();
public function setParent(&$parent) {
$this->parent = $parent;
}
public function addChild($child) {
$this->childs[] = $child;
}
}
for ($i = 1; $i <= 16; $i++) {
$a = new A();
for ($j = 1; $j <= 16; $j++) {
$b = new A();
$b->setParent($a);
$a->addChild($b);
}
echo "$i: " . memory_get_usage()."\n";
}
}}}
Let me know if you (or anyone for that matter) come up with a solution to that.
Even
5.3.0RC1 leaks memory with this code.
Original comment by svollbehr
on 26 Apr 2009 at 5:32
Original comment by svollbehr
on 30 Apr 2011 at 8:12
Original issue reported on code.google.com by
Patty.Li...@gmail.com
on 24 Apr 2009 at 6:03Attachments: