httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thib <>
Subject How to manage memory allocation/free in the handler ?
Date Fri, 04 Apr 2008 12:07:33 GMT

I need to allocate memory during the execution of my module's handler.

I'm used to do this action with the apr_pcalloc function in the
configuration methods.

For example, in create_snu_config : new_cfg = (snu_config *) apr_pcalloc(p,

This section is executed once, but in the handler, the allocation
instruction is called at each request.

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...).

Do you know what is the best practice ?
- Create a new memory pool with apr_pool_create, use it and destroy it at
the end of the handler call
- Use a "free" method (as free or another method)
- Don't use apr_pcalloc but traditional malloc and free functions

Thanks a lot for your help ;)


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message