Re: unset() and variables in functions

From: Date: Tue, 12 Sep 2000 19:44:43 +0000
Subject: Re: unset() and variables in functions
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-16428@lists.php.net to get a copy of this message
Hello Matt, I re-read that (I'd read it before). Still, though, it doesn't specifically say that if a variable in a function is freed when the function is finished. It notes that variables in functions are only referenced to the variabled passed to the function, and the function variable is given it's own address only if the value of the function variable changes. However, it doesn't say what happens to it when the function is done. I *assume* that it is freed, as this Zend engine seems to be thoroughly thought out. That is a good read and I like the improvements. One of the main problems, though, is that I'm using this search script mostly with PHP3 still (out of my control). It's been used successfully for about 12 months now, but I'm always trying to tweak it. The part that could use some tweaking, I think, is freeing memory when it's not being used. Thanks in advance, Hans On Tue, 12 Sep 2000, Matt Schroebel wrote: > >>> "Hans H. Anderson" <php@hansanderson.com> 09/12 3:09 PM > >>> >>> > >>In an effort to make an intensive search script as efficient as possible, > >> I was wondering: > >> does unset() actually free the memory of that variable, or does it just > >> empty it? > >> after a function returns, user-defined or PHP-defined, are all the local > >> variables in that function freed, or do I need to free them myself? > > In PHP 4 you don't have to worry about freeing variables, it's done for you > automatically. If you want the inside details, read > http://www.zend.com/zend/art/ref-count.php > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > -- Hans Anderson -=- me@hansanderson.com | PHP, SQL Databases, Flash 5 Animation http://www.hansanderson.com | & Programming, Killer Audio Production, http://www.goofiness.com | Search Engines, Brewmeister.

« previous php.general (#16428) next »