# circular references

- Thread: https://externals.io/message/1898
- Original archive: https://news-web.php.net/php.internals/1898
- Started by Wojtek Meler on 2003-05-22T17:32:40+00:00
- Messages: 3
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #1900 — Wei He — 2003-05-22T17:11:05+00:00

URL: https://externals.io/message/1898#1900 · In reply to: #1898

> When you run:
> <?
> $a=array();
> $b[]=&$a;
> $a[]=&$b;
> ?>
> 

I'm also interested in it but I didn't see the warning on my platform 
running your example.

Wei He

---

## #1898 — Wojtek Meler — 2003-05-22T17:32:40+00:00

URL: https://externals.io/message/1898#1898

When you run:
<?
$a=array();
$b[]=&$a;
$a[]=&$b;
?>

You will get warnings about memory leaks. I know that it is ugly code 
etc. but shouldn't it be solved by ZE? It should free such things properly.
I know that in this simple case whole memory is freed, but if we add 
resource to $a table, resource desctructor won't be called because
of reference - that's why PHP leeks memory. Am I right?

regards,
Wojtek

---

## #1899 — marcus.boerger@t-online.de — 2003-05-22T18:03:46+00:00

URL: https://externals.io/message/1898#1899 · In reply to: #1898

At 19:32 22.05.2003, Wojtek Meler wrote:
>When you run:
><?
>$a=array();
>$b[]=&$a;
>$a[]=&$b;
>?>
>
>You will get warnings about memory leaks. I know that it is ugly code etc. 
>but shouldn't it be solved by ZE? It should free such things properly.
>I know that in this simple case whole memory is freed, but if we add 
>resource to $a table, resource desctructor won't be called because
>of reference - that's why PHP leeks memory. Am I right?

Putting out the warning is better.
Eventually a damn note that the user shoot his self in the knee.
But that would slow down performance.

AND a side note: even java does not handle that.

regards
marcus
