DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=23567>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=23567





------- Additional Comments From [EMAIL PROTECTED]  2007-08-28 12:51 -------
(In reply to comment #10)
> Just brain-dumping, the design issue here is, per Jeff's analysis and 
> subsequent
> discussion:
> 
> 1. brigades are allocated out of pools
> 2. every call to apr_brigade_split allocates a new brigade
> 3. every time a FLUSH bucket it sent down the filter stack, it causes at least
> one call to apr_brigade_split
> 
> fixes for this could be either:
> 
> fix (1), allocate brigades out of the bucket-allocator so that they can really
> be free'd (very intrusive since many filters presume brigades are never really
> destroyed)
> 
> fix (3), adjust all filters to ensure that they don't allocate a number of
> brigades per request (and hence, memory allocated) which is proportional to
> number of FLUSH buckets sent.

What about an apr_brigade_split_ex that takes an additional brigade as
parameter? This brigade could be used instead of creating a new one and could
be stored in the context of the filter for subsequent recyling (like we do in
other places). So something like:

APU_DECLARE(apr_bucket_brigade *) apr_brigade_split_ex(apr_bucket_brigade *b,
                                                       apr_bucket *e
                                                       apr_bucket_brigade *a)
{
    apr_bucket *f;

    if (!a) {
        a = apr_brigade_create(b->p, b->bucket_alloc);
    }
    else if (!APR_BRIGADE_EMPTY(a)) {
        apr_brigade_cleanup(a);
    }
    /* Return an empty brigade if there is nothing left in·
     * the first brigade to split off·
     */
    if (e != APR_BRIGADE_SENTINEL(b)) {
        f = APR_RING_LAST(&b->list);
        APR_RING_UNSPLICE(e, f, link);
        APR_RING_SPLICE_HEAD(&a->list, e, f, apr_bucket, link);
    }

    APR_BRIGADE_CHECK_CONSISTENCY(a);
    APR_BRIGADE_CHECK_CONSISTENCY(b);

    return a;
}

APU_DECLARE(apr_bucket_brigade *) apr_brigade_split(apr_bucket_brigade *b,
                                                       apr_bucket *e)          
                                    
{
   return apr_brigade_split_ex(b, e, NULL);
}

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to