I am trying to understand this article " PHP Manual → Features → Garbage Collection " unfortunately, not everything is clear to me.
1.
To avoid the need to call checking garbage cycles with each possible reduction, the algorithm instead puts all possible zvals in the “root buffer”.
but what if
<?php
$a = new \stdClass(); (1)
$a = new \stdClass();
Then I assume that the first object will become a "lost" zval, like
no_symbol: (refcount = 1, is_ref = 1) = stdObject
Will such "lost" zvals be added to the root buffer or not? There is no handler for them.
2.
Variables created in the function area, what happened to them?
Example:
<?php
function test($a = 'abc') {
$c = 123;
return 1;
}
test();
echo 'end';
$a $c gc?
refcount, 1.
? , ( ?)
3.
?
Ex
<?php
$a = array('abc');
$a[] =& $a;
unset($a);
(refcount=1, is_ref=1)=array (
0 => (refcount=1, is_ref=0)='abc',
1 => (refcount=1, is_ref=1)=...
)