summaryrefslogtreecommitdiffhomepage
path: root/src/http/ngx_http_request.c
diff options
context:
space:
mode:
authorMaxim Dounin <mdounin@mdounin.ru>2012-11-13 11:21:31 +0000
committerMaxim Dounin <mdounin@mdounin.ru>2012-11-13 11:21:31 +0000
commit1954cf149aa79ba2bb1ce0b7b20422ab2ca6c93a (patch)
tree7d590f1dfb78b69f6b6ef08220b9201de0710d4a /src/http/ngx_http_request.c
parentde72cc29aa580977ba27ead248e9e42da66702ad (diff)
downloadnginx-1954cf149aa79ba2bb1ce0b7b20422ab2ca6c93a.tar.gz
nginx-1954cf149aa79ba2bb1ce0b7b20422ab2ca6c93a.tar.bz2
Merge of r4892: keepalive memory usage optimization.
The ngx_http_keepalive_handler() function is now trying to not keep c->buffer's memory for idle connections. This behaviour is consistent with the ngx_http_set_keepalive() function and it should decrease memory usage in some cases (especially if epoll/rtsig is used).
Diffstat (limited to 'src/http/ngx_http_request.c')
-rw-r--r--src/http/ngx_http_request.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c
index 479b106cf..ee00fd3af 100644
--- a/src/http/ngx_http_request.c
+++ b/src/http/ngx_http_request.c
@@ -2745,6 +2745,20 @@ ngx_http_keepalive_handler(ngx_event_t *rev)
ngx_http_close_connection(c);
}
+ /*
+ * Like ngx_http_set_keepalive() we are trying to not hold
+ * c->buffer's memory for a keepalive connection.
+ */
+
+ if (ngx_pfree(c->pool, b->start) == NGX_OK) {
+
+ /*
+ * the special note that c->buffer's memory was freed
+ */
+
+ b->pos = NULL;
+ }
+
return;
}