Thanks again for spotting this. I've changed expandDirectives() and  
also expandVariables(). Both are now more than three times faster,  
and this memory leak is completely eliminated. See http:// 
trac.agavi.org/changeset/2092


David



Am 04.09.2007 um 15:40 schrieb mugeso:

> Hi,
>
> I suggest not to use create_function.
> Because it waste the memory for each calling even if create the same
> function.
> For example, create_function in AgaviToolkit::expandDirectives use
> 4864bytes per call.
> And it is executed 617 times while the sample's DefaultAction is
> runing.(debug mode)
> This means about 2.9M bytes are used only for create_function.
> It's really waste, don't you think?
>
> test code:
> ------------
> <?
> function cf()
> {
>     // this code is from AgaviToolkit::expandDirectives
>     create_function('$match',
>                     '$constant = $match[1];' .
>                     'return (AgaviConfig::has($constant) ?
> AgaviConfig::get($constant) : "%".$constant."%");'
>                     );
> }
>
> for($i=0; $i < 20000; $i++) cf();
> ?>
> ----------
>
>
> regards,
>
> MugeSo
>
>
>
> _______________________________________________
> Agavi Dev Mailing List
> [email protected]
> http://lists.agavi.org/mailman/listinfo/dev
>


_______________________________________________
Agavi Dev Mailing List
[email protected]
http://lists.agavi.org/mailman/listinfo/dev

Reply via email to