httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eric Covener" <cove...@gmail.com>
Subject Re: How to manage memory allocation/free in the handler ?
Date Fri, 04 Apr 2008 13:11:01 GMT
On Fri, Apr 4, 2008 at 8:07 AM, Thib <cheprod@gmail.com> wrote:

>  For example, in create_snu_config : new_cfg = (snu_config *) apr_pcalloc(p,
>  sizeof(snu_config));
>
>  And I don't know how to free this memory at the end of the handler method. I
>  don't find any method in apr to do that (as apr_pfree...).
>

Each pool available to you  at different stages has a fixed lifetime
and is cleaned up by apache, including recliaming anything you've
allocated.  You shouldn't have to manually manipulate this unless you
want it to live shorter/longer then a pool you have access to.

Are you creating a new config too often?  Normal data that only has to
live as long as a request should be allocated out of r->pool ("request
pool")

http://www.apachetutor.org/dev/pools

-- 
Eric Covener
covener@gmail.com

Mime
View raw message