On 10/04/2009 09:37 AM, sf@apache.org wrote:
> Author: sf
> Date: Sun Oct 4 07:37:28 2009
> New Revision: 821471
>
> URL: http://svn.apache.org/viewvc?rev=821471&view=rev
> Log:
> core, mod_deflate, mod_sed: Reduce memory usage by reusing bucket
> brigades in several places
>
> Modified:
> httpd/httpd/trunk/CHANGES
> httpd/httpd/trunk/modules/filters/mod_deflate.c
> httpd/httpd/trunk/modules/filters/mod_sed.c
> httpd/httpd/trunk/modules/http/chunk_filter.c
> httpd/httpd/trunk/server/protocol.c
>
> Modified: httpd/httpd/trunk/server/protocol.c
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/protocol.c?rev=821471&r1=821470&r2=821471&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/server/protocol.c (original)
> +++ httpd/httpd/trunk/server/protocol.c Sun Oct 4 07:37:28 2009
> @@ -1300,16 +1302,15 @@
> * do a blocking read on the next batch.
> */
> if (e != APR_BRIGADE_FIRST(b)) {
> - apr_bucket_brigade *split = apr_brigade_split(b, e);
> + apr_brigade_split_ex(b, e, ctx->tmpbb);
> apr_bucket *flush = apr_bucket_flush_create(r->connection->bucket_alloc);
>
> APR_BRIGADE_INSERT_TAIL(b, flush);
> rv = ap_pass_brigade(f->next, b);
> if (rv != APR_SUCCESS || f->c->aborted) {
> - apr_brigade_destroy(split);
> return rv;
> }
> - b = split;
To be on the safe side we should do apr_brigade_cleanup(b) here.
> + APR_BRIGADE_CONCAT(b, ctx->tmpbb);
> e = APR_BRIGADE_FIRST(b);
>
> ctx->data_sent = 1;
Regards
RĂ¼diger
|