httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jason Fister" <jasonfis...@gmail.com>
Subject Re: Local Memory pool
Date Thu, 24 Jul 2008 14:28:04 GMT
I am sending this again hoping someone would respond.

Thanks in advance.

Jason

On Tue, Jul 22, 2008 at 11:42 AM, Jason Fister <jasonfister@gmail.com>
wrote:

> Hello all,
>
> In my apache module, I receive, process and return large amounts of data.
> The size of the data could be as large as 100's of megabytes. I allocate
> memory from the request pool and let apache clean up the memory after each
> request is served.
>
> Although, apache is supposed to reclaim memory after each request is
> served, I would like to explicitly clean up memory after processing each
> request. This is because of the fact that size of data associated with each
> requests and a large number of clients calling in to the module.
>
> After doing some research this is what I am thinking about doing. In my
> module_handler
>
>     apr_allocator_t *local_allocator = NULL;
>     apr_pool_t *localPool = NULL;
>
>     apr_allocator_create(&local_allocator);
>     apr_pool_create_ex(&localPool, NULL, NULL, local_allocator);
>     ...................
>     ...................
>     allocate memory from this local pool
>     ...................
>     ...................
>
>     apr_pool_destroy(localPool);
>     apr_allocator_destroy(local_allocator);
>
>     return OK;
>
>
> Do you guys see any problem with this approach?
>
>
> Jason Fister
>

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