Re: [PHP] references, circular references, oop, and garbage collection in PHP5

2005-12-08 Thread Alan Pinstein
/* comments inline */ On Dec 8, 2005, at 2:34 AM, Curt Zirzow wrote: On Wed, Dec 07, 2005 at 09:30:36PM -0500, Alan Pinstein wrote: On Dec 7, 2005, at 12:36 AM, Curt Zirzow wrote: I'm not sure how you mean a weak reference, and well a refcount is rather meaning less in php userland. So, t

Re: [PHP] references, circular references, oop, and garbage collection in PHP5

2005-12-07 Thread Curt Zirzow
On Wed, Dec 07, 2005 at 09:30:36PM -0500, Alan Pinstein wrote: > > On Dec 7, 2005, at 12:36 AM, Curt Zirzow wrote: > > > >I'm not sure how you mean a weak reference, and well a refcount is > >rather meaning less in php userland. > > So, this gets interesting. I don't know if you're familiar with

Re: [PHP] references, circular references, oop, and garbage collection in PHP5

2005-12-07 Thread Alan Pinstein
On Dec 7, 2005, at 12:36 AM, Curt Zirzow wrote: My original statement was to show how the the php4 = &$o is different. Oh, well, sure I believe that! :) In php5 variables are just containers that point to objects, so when you make a variable a reference to another variable all you are doi

Re: [PHP] references, circular references, oop, and garbage collection in PHP5

2005-12-07 Thread Alan Pinstein
Hey Ray- Thanks for the link! Actually, the article didn't help directly, but it did spark an idea. My main problem all along was trying to get a true reference to $this. For some reason reading the article led me to try "$this- >this", which works, to my surprise! So, I now have a complet

Re: [PHP] references, circular references, oop, and garbage collection in PHP5

2005-12-07 Thread Alan Pinstein
[ man.. I just realized that "reply" to this list doesn't send to the list... replies being re-sent... thanks for the help! ] On Dec 6, 2005, at 10:45 PM, Curt Zirzow wrote: I'm going to jump to the code as fast as possible to explain what I can, the key thing to remember in php5 is that the

Re: [PHP] references, circular references, oop, and garbage collection in PHP5

2005-12-06 Thread Anas Mughal
One example he presented is suited to pre-PHP5. With PHP5, a reference to self could be kept inside the class as a static member. No need to use a global variable. Just wanted to bring this up for new comers to PHP references and global variables. Cheers. On 12/6/05, Ray Hauge <[EMAIL PROTECT

Re: [PHP] references, circular references, oop, and garbage collection in PHP5

2005-12-06 Thread Curt Zirzow
On Tue, Dec 06, 2005 at 10:46:36PM -0500, Alan Pinstein wrote: > >the key thing to remember in php5 is that the old &$var > >declaration has no real meaning in objects. php5's objects exist > >outside of the old oop reference. Consider: > > Hmmm... I am not sure I believe this. > > I understand

Re: [PHP] references, circular references, oop, and garbage collection in PHP5

2005-12-06 Thread Curt Zirzow
I'm going to jump to the code as fast as possible to explain what I can, the key thing to remember in php5 is that the old &$var declaration has no real meaning in objects. php5's objects exist outside of the old oop reference. Consider: class Object { public $val; function __construct($v) {

Re: [PHP] references, circular references, oop, and garbage collection in PHP5

2005-12-06 Thread Ray Hauge
I am uncertain on this, but I believe that the $this variable is already just a reference to the class you are calling it from. Then passing the reference by-reference to the addParent() method of the Child class could be what is causing your issue. I'd be curious to see what would happen if

[PHP] references, circular references, oop, and garbage collection in PHP5

2005-12-06 Thread Alan Pinstein
So.. I am having PHP5 memory management problems. They are similar to those described in this thread: http://aspn.activestate.com/ASPN/Mail/Message/php-Dev/1555640 (so maybe this question belongs on php-dev but I figured I'd try here first... seems like a userland question) Basically I have