httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cliff Woolley <cliffwool...@yahoo.com>
Subject Re: Buckets vs. Re-allocations
Date Wed, 17 Oct 2001 19:58:05 GMT
On Wed, 17 Oct 2001, Eli Marmor wrote:

> Any time that the issue of "realloc()" is raised, the automatic answer
> is that instead of resizing your buffer to include the extended
> content using realloc(), it is better to just add one more bucket.

-1 to reallocing bucket buffers.  It breaks the whole zero-copy mantra,
and a better alternative already exists:

> Sometimes, there are *MANY* small chunks (e.g. lines of content),

In that case, use the filter/bucket buffering code (ap_fprintf,
apr_brigade_*printf, etc).  It allocates a big buffer for you and keeps
appending content to it until it fills up, then it starts on a new bucket
with a new buffer.

--Cliff

--------------------------------------------------------------
   Cliff Woolley
   cliffwoolley@yahoo.com
   Charlottesville, VA




Mime
View raw message