perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject Re: [mp2] why Apache::PerlSections gets resolved so many times?
Date Sun, 02 Jan 2005 06:40:49 GMT
Philippe M. Chiasson wrote:
>>>> Is parms->pool freed when config phase is over?
>>>
>>>
>>> Well, AFAIK, parms->pool is process->pconf, and that doesn't get wiped
>>> until the process terminates.
>>
>>
>> So we need to use a temp pool instead.
> 
> 
> Yes, most certainly, and that would have to be parms->temp_pool
> 
> Index: src/modules/perl/modperl_cmd.c
> ===================================================================
> --- src/modules/perl/modperl_cmd.c      (revision 123857)
> +++ src/modules/perl/modperl_cmd.c      (working copy)
> @@ -420,7 +420,7 @@
> 
> MP_CMD_SRV_DECLARE(perl)
> {
> -    apr_pool_t *p = parms->pool;
> +    apr_pool_t *p = parms->temp_pool;
>     const char *endp = ap_strrchr_c(arg, '>');
>     const char *errmsg;
>     char *code = "";
> @@ -473,7 +473,7 @@
> 
> MP_CMD_SRV_DECLARE(perldo)
> {
> -    apr_pool_t *p = parms->pool;
> +    apr_pool_t *p = parms->temp_pool;
>     server_rec *s = parms->server;
>     apr_table_t *options;
>     modperl_handler_t *handler = NULL;

smells tabs to me :)

> 
> And that's just for <Perl> sections, and a cursory glance suggests that 
> there
> could be a bunch of other configuration directives that mistakenly use 
> parms->pool.
> 
> I'll have a look and report later.

and please log that onto todo/release so we don't forget to review the code.

>> It's about time we should start thinking about optimizations. I'd 
>> check other startup thingies that may use the wrong pool which wastes 
>> memory at run-time.
> 
> 
> See above!

Cool.

>>>> If it is then this effort is certainly moot.
>>>
>>>
>>> See above, but I think there is certainly a better solution.
>>>
>>> <Pseudo-code>
>>> if (!modperl_handler_lookup_handlers()) {
>>>  modperl_handler_new();
>>>  modperl_cmd_push_handlers();
>>> }
>>> </Pseudo-code>
>>>
>>> I'll submit a patch to illustrate this later on.
> 
> 
> Aftering tinkering about this aproach a bit, it seems to me that's it's 
> way overkill.
> after all, modperl_handler_new() is not a significant overhead for each 
> <Perl> sections
> and with my suggested patch (above), they are proprely freed on startup.
> 
> Any objections to leaving it as is with the patch above ?

Nope, as long as things are cleaned up, that looks fine to me.


-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Mime
View raw message