Buffers of zero size and filter module

Valentin V. Bartenev ne at vbart.ru
Fri Jul 27 14:01:33 UTC 2012

On Friday 27 July 2012 10:53:35 Daniel Fiala wrote:
> Hello.
> On 25 July 2012 23:29, Valentin V. Bartenev <ne at vbart.ru> wrote:
> > > * Is the number of buffers of zero size small? As I understand, memory
> > > of the chain-link is not recycled until the http request is not fully
> > > processed.
> > 
> > But it is actively reused. If you look at the ngx_alloc_chain_link()
> > function you will find that it tries to get a link from pool->chain,
> > while ngx_free_chain() puts chain links to pool->chain.
> And is ngx_free_chain(.) really called form
> ngx_http_charset_filter_module.c ?

No, charset filter doesn't call it. I spoke in general. The charset filter 
reuses chains for its own buffers, but doesn't free chains those were allocated
for anything else. Since a chain is just two pointers, so that is not critical.

> It seems, that it has been added to
> ngx_chain_update_chains(.)
> ( http://mailman.nginx.org/pipermail/nginx-devel/2011-September/001178.html
> ), but this function is not used very often. Modules seem to process
> buffers own way.

Sure, their own buffers they should process in own way.

wbr, Valentin V. Bartenev

More information about the nginx-devel mailing list