reference counting and garbage collection
| From: | Dean Hall | Date: | Fri, 03 Nov 2000 20:07:08 +0000 |
| Subject: | reference counting and garbage collection | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-23632@lists.php.net to get a copy of this message | ||
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.