Re: Re: PHP 4.0 Bug #6333 Updated: garbage collection is not being performed on create_function?
| From: | Andi Gutmans | Date: | Thu, 07 Sep 2000 16:33:12 +0000 |
| Subject: | Re: Re: PHP 4.0 Bug #6333 Updated: garbage collection is not being performed on create_function? | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-32577@lists.php.net to get a copy of this message | ||
There might be a coding standard solution for your problem. I don't know the details of your application but you might be able to do without create_function().
I usually think that it's good programming practice to avoid things like create_function() and eval() if possible. And yes, I know that sometimes it isn't really possible and/or it does make sense not to use them. Are you sure this is your case?
Andi
At 05:12 PM 9/7/00 +0100, Ed Law wrote:
Yes I know how it works. But seeing as you have features like bind(), listen() and other functions normally associated with proper 'applications' you will inevitably get people running shell scripts 24/7. Such as what I have done, I made a ircbot in PHP that stays connected even though you reload its script 'modules', except I have to restart it every so often to flush memory because of this 'bug'. Im probably not going to be the only one, either. PHP is much more than simply a pre-html parser. Its pretty much replaced PERL for me. - ewdafa / ed ----- Original Message ----- From: "Bug Database" <php-dev@lists.php.net> To: <ewdafa@ewdafa.b0rk.co.uk> Sent: Thursday, September 07, 2000 4:43 PM Subject: PHP 4.0 Bug #6333 Updated: garbage collection is not being performed on create_function? ID: 6333 Updated by: andi Reported By: ewdafa@ewdafa.b0rk.co.uk Status: Closed Bug Type: Performance problem Assigned To: Comments: This isn't a bug but how it works. Each create_function() call creates a new unique function. So obviously if you define zillions in an infinite loop you'll run out of memory. Previous Comments: [2000-08-24 09:57:38] ewdafa@ewdafa.b0rk.co.uk the following code causes PHP to continually eat more and more memory where it should be destroying the old reference for $func. while(1) { $array = array(); $func = create_function('', "return 0;"); $array[] = $func; $func = 0; echo "sleeping for a second.n"; sleep(1); } -------------------------------------------------------------------------- - Full Bug description available at: http://bugs.php.net/?id=6333 -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net For additional commands, e-mail: php-dev-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net--- Andi Gutmans <andi@zend.com> http://www.zend.com/