in reply to Re: DESTROYing an object
in thread DESTROYing an object

The first piece of code doesn't. In each iteration, a reference to an outer $variable is taken, and stored in the innter $variable. But the space for this variable is reused in the next iteration - it went out of scope at the end of the previous iteration.

As for the second one, it depends. What else is there in the code? Each object created my this constructor will have two references to itself, so unless there's code to remove the self referentials, the objects will not be garbage collected before the end of the program. But that in itself isn't necessarely a memory leak.

Abigail