apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Pane <brian.p...@cnet.com>
Subject Re: [PATCH] Update to Brian's patch to allocate brigades out of the bucket allocator
Date Fri, 20 Dec 2002 18:24:18 GMT
On Fri, 2002-12-20 at 08:57, rbb@apache.org wrote:
> I am actually pretty sure that allocating brigades out of the
> bucket_allocator is a VERY big mistake.  In fact, I am close to asking
> that change to be backed out because it is too dangerous.
> When we first designed buckets and bucket brigades, we made one VERY clear
> distinction.  Bucket_brigades are allocated out of a pool, because that
> stops us from leaking memory.

Allocating brigades from a pool is often a design mistake.
Brigades tend to outlive the transactions that produce
them (especially in apps like http servers), and having a
brigade disappear as a side-effect of a transaction pool's
cleanup will cause problems elsewhere in the code.

> By allocating bucket_brigades out of the bucket_allocator, we have removed
> the protection that the pool cleanups used to give us.

It's important to keep in mind just what sort of protection
the pool-based brigade allocation offered.  It allowed code
that did this:

    bb = apr_brigade_create(...);
    APR_BRIGADE_INSERT_HEAD(bb, bucket);

to work accidentally.  I'm hesitant to call that "protection."


View raw message