On Thu, 28 Aug 2003 [EMAIL PROTECTED] wrote:
> Index: threadpool.c
> ===================================================================
> RCS file: /home/cvs/httpd-2.0/server/mpm/experimental/threadpool/threadpool.c,v
> retrieving revision 1.17
> retrieving revision 1.18
> diff -u -d -u -r1.17 -r1.18
> --- threadpool.c 27 Aug 2003 22:33:11 -0000 1.17
> +++ threadpool.c 28 Aug 2003 05:54:44 -0000 1.18
> @@ -981,12 +981,10 @@
>
> apr_allocator_create(&allocator);
> apr_allocator_max_free_set(allocator, ap_max_mem_free);
> + /* XXX: why is ptrans's parent not tpool? --jcw 08/2003 */
> apr_pool_create_ex(&ptrans, NULL, NULL, allocator);
> apr_allocator_owner_set(allocator, ptrans);
> -
> - /* XXX: What happens if this is allocated from the
> - * single-thread-optimized ptrans pool? -aaron */
> - bucket_alloc = apr_bucket_alloc_create(tpool);
> + bucket_alloc = apr_bucket_alloc_create_ex(allocator);
>
Side note: to answer this question of yours, Aaron, if bucket_alloc had
been allocated from ptrans, then when ptrans got cleared, the bucket
allocator would get destroyed. Note that this actually /is/ what I'm now
doing in the worker MPM... I create a new bucket_alloc per transaction and
let it get destroyed when ptrans gets cleared. Since
apr_bucket_alloc_create() is no longer creating its own allocator but
rather using the one from the parent pool, I figure this is okay, since no
actual malloc() calls ought to happen.
Can anybody answer the question I inserted? Why would it not be
apr_pool_create_ex(&ptrans, pthrd, NULL, allocator);
rather than
apr_pool_create_ex(&ptrans, NULL, NULL, allocator);
Doesn't the latter leak memory if you destroy a thread and replace it with
another thread? I guess if you never do that it's no big deal.
--Cliff