Hi all,
What do you think about freeing buffers after being sent by send_chain?
Because we have a special case were we use 4 megabyte buffer instead of
nginx default 8 * 8 K and we found that these buffers are actually freed
after request had been finished, so if there hundreds of slow downstream
connection nginx will eat a lot of RAM.
I'm just curious if I explicitly return already consumed buffer with
ngx_pfree will affect something (our bunch of tests shows at least there
is not crash or unexpected behaviour)
@@ -284,6 +284,13 @@ ngx_http_write_filter(ngx_http_request_t *r,
ngx_chain_t *in)
chain = c->send_chain(c, r->out, limit);
+ /* free buffs that are already sent */
+ for (cl = r->out; cl; /* void */) {
+ ln = cl;
+ cl = cl->next;
+ ngx_pfree(c->pool, ln->buf);
+ }
+
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
"http write filter %p", chain)
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel