Hi,
Thanks for this response.
For the new config, there is no problem because I create a new one only when
my "create config method" (create_snu_config method) is called :
static void *create_snu_config(apr_pool_t *p, server_rec *s)
{
...
newcfg = (snu_config *) apr_pcalloc(p, sizeof(snu_config));
...
}
However, on the handler method (snu_handler) which is called at each time a
client perform a request, I need to allocate memory. I wrote the following
instruction :
static int snu_handler(request_rec *r)
{
...
eni.calling = (char *) apr_pcalloc(r->pool, TAILL_CHAMPS * sizeof(char));
...
}
My mistake was "how to free this allocated memory?".
If I understand well:
- The request_rec pool (r->pool) is not the same pool as the
apr_pool_t "p" used in the create_snu_config method
- The request_rec pool (r->pool) is free automatically at the end of
the client request (end of the snu_handler pool)
Thanks a lot for your help (and sorry for my english).
Thib
2008/4/4, Eric Covener <[EMAIL PROTECTED]>:
>
> On Fri, Apr 4, 2008 at 8:07 AM, Thib <[EMAIL PROTECTED]> 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
> [EMAIL PROTECTED]
>