Open ClosetGeek-Git opened 5 years ago
Yeah sure. Cyclic references occur when you nest an object (or an array reference) within itself. In normal PHP code, this looks something like the following:
$o = new StdClass();
$o->prop = $o;
So the prop
property references the object itself, forming a cycle. PHP has a mark-and-sweep cycle detector to handle these cycles, but I haven't written this for pht (and I don't really plan to, in the interest of simplicity). So if you do something like the following in pht:
$queue = new Queue();
$queue->push($queue);
Then this will leak, since the extension handles garbage collection of these object across threads (so it avoids using PHP's garbage collection mechanism).
Due to the simplicity of the data structures, I don't see any strong reasons as to why cyclic referencing would be needed anyway.
The README states "cyclic references will leak" in the data structure section. Can you detail this further?