Login | Register
My pages Projects Community openCollabNet

Reply to message

2020-03-13: This site is going to be decommissioned and shut down very soon. Please copy and archive any data you wish to keep ASAP

* = Required fields
* Subject
* Body
Send reply to
Author (directly in email)
Please type the letters in the image above.

Original message

Author Alan Pinstein <apinstein@mac.com>
Full name Alan Pinstein <apinstein@mac.com>
Date 2005-12-06 12:20:45 PST
Message Further progress.... after lunch my mind started working again.

Ok. So, I have figured out what's going on....

So when memory-managing objects with circular links, the normal way
to do this is to have parents "retain" (keep ref-counted links) to
their kids, and have the kids have "weak references" (non-ref-
counted) links to their parents. This way, when the parent is no
longer used, it will automatically 0-out the ref counts to all
children it links too and things GC correctly.

Now, how to do this in PHP?

Well, it seems that if you create a reference to another object, it's
refCount isn't bumped... see the attached weakRefTest.php for an