<div dir="ltr"><div>Hi all,</div><div><br></div><div>What do you think about freeing buffers after being sent by send_chain?<br></div><div>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. </div><div><br></div><div>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) </div><div><br></div><div><br></div><div><div>@@ -284,6 +284,13 @@ ngx_http_write_filter(ngx_http_request_t *r, ngx_chain_t *in)</div><div> </div><div>     chain = c->send_chain(c, r->out, limit);</div><div> </div><div>+    /* free buffs that are already sent */</div><div>+    for (cl = r->out; cl; /* void */) {</div><div>+        ln = cl;</div><div>+        cl = cl->next;</div><div>+        ngx_pfree(c->pool, ln->buf);</div><div>+    }</div><div>+</div><div>     ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,</div><div>                    "http write filter %p", chain)</div></div></div>