Re: reference counting and garbage collection
| From: | Michael Kimsal | Date: | Fri, 03 Nov 2000 21:13:11 +0000 |
| Subject: | Re: reference counting and garbage collection | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-23642@lists.php.net to get a copy of this message | ||
I'm pretty sure this person doesn't quite know what they're talking about.
http://www.zend.com/zend/art/ref-count.php
is an article
by Zeev that has a lot of info on reference counting. There are a couple
issues they mention with respect to being careful with code,
but I've never seen anything regarding this. In fact, PHP4 in particular
has been, in my experience, the only platform I've never had any garbage
collection
issues with at all, and I don't unset() things all that much.
Dean Hall wrote:
> I read something today from someone else's source that made me think. He
> said that since PHP uses reference counters, you need to 'unset' all your
> references before you exit your script. In particular, he was talking about
> an n-ary tree data structure he had made. He insisted in his comments that
> before the script ends, you call his cleanup method that goes through the
> entire tree and 'unset's all the references to parents and children.
>
> I'm worried about this, because I wrote an n-ary tree data structure as a
> navigation hierarchy for my website
> <http://www.apt7.com/src/NavNode.txt>.
> It uses references to keep track of its parent and its children. Do I need
> to unset these before script execution ends? Will I end up with memory
> leaks? I'm not familiar enough with the innards of PHP to know.
>
> Thanks to any brave enough to tackle this.
> Dean.
--
==========================
Michael Kimsal
http://www.tapinternet.com
734-480-9961