Re: [PHP-DEV] Re: PHP 4.0 Bug #6333 Updated: garbage collection is not being performed on create_function? From: Andi Gutmans (andi <email protected>)
Date: 09/07/00

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 <email protected>>
>To: <ewdafa <email protected>>
>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 <email protected>
> > 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 <email protected>
> > 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 <email protected>
>For additional commands, e-mail: php-dev-help <email protected>
>To contact the list administrators, e-mail: php-list-admin <email protected>

---
Andi Gutmans <andi <email protected>>
http://www.zend.com/

-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>