perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Philippe M. Chiasson" <go...@ectoplasm.org>
Subject Re: Connection pnotes
Date Fri, 10 Mar 2006 20:46:12 GMT
Geoffrey Young wrote:
>>All tests pass for me on various platforms, but...
>>
>>Where do you cleanup HV *modperl_config_con_t->pnotes ? Looks to me
>>like you are leaking it. You'd need something similar to what we
>>are doing for request pnotes:
>>
>>apr_status_t modperl_config_request_cleanup(pTHX_ request_rec *r)
>>{
>>    [...]
>>
>>    if (rcfg->pnotes) {
>>        SvREFCNT_dec(rcfg->pnotes);
>>        rcfg->pnotes = Nullhv;
>>    }
> 
> I have some comments on that in the code
> 
>     /* note we do not need to implement a per-connection cleanup to
>      * reset $c->pnotes.  this is because we don't hook into
>      * ap_hook_create_connection and therefore each new connection
>      * has no &perl_module data in the configuration vector
> 
> however, refcounting isn't really my thing, so I'll accept your analysis if
> you think mine above is insufficient (which it may well be, since you're
> smarter about these things than I am :)

What I mean is that you are leaking a HV. Every connection, if someone uses
c->pnotes, you will run this code:

    if (!ccfg->pnotes) {
        ccfg->pnotes = newHV();
    }

And you have nothing in place to cleanup this newly created HV (and it's contents)

--------------------------------------------------------------------------------
Philippe M. Chiasson m/gozer\@(apache|cpan|ectoplasm)\.org/ GPG KeyID : 88C3A5A5
http://gozer.ectoplasm.org/     F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3A5A5

Mime
View raw message