[nginx] svn commit: r4908 - in branches/stable-1.2: . src/http

mdounin at mdounin.ru mdounin at mdounin.ru
Tue Nov 13 11:21:32 UTC 2012


Author: mdounin
Date: 2012-11-13 11:21:31 +0000 (Tue, 13 Nov 2012)
New Revision: 4908
URL: http://trac.nginx.org/nginx/changeset/4908/nginx

Log:
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).


Modified:
   branches/stable-1.2/
   branches/stable-1.2/src/http/ngx_http_request.c

Index: branches/stable-1.2
===================================================================
--- branches/stable-1.2	2012-11-13 11:00:37 UTC (rev 4907)
+++ branches/stable-1.2	2012-11-13 11:21:31 UTC (rev 4908)

Property changes on: branches/stable-1.2
___________________________________________________________________
Modified: svn:mergeinfo
## -1 +1 ##
-/trunk:4611-4632,4636-4657,4671-4672,4674-4676,4682,4684-4699,4704-4706,4713,4736-4741,4754,4756-4771,4775,4777-4780,4782-4785,4795,4811-4820,4822-4824,4828-4835,4840-4844,4865-4872,4885-4887,4890-4891,4893-4895
+/trunk:4611-4632,4636-4657,4671-4672,4674-4676,4682,4684-4699,4704-4706,4713,4736-4741,4754,4756-4771,4775,4777-4780,4782-4785,4795,4811-4820,4822-4824,4828-4835,4840-4844,4865-4872,4885-4887,4890-4895
\ No newline at end of property
Modified: branches/stable-1.2/src/http/ngx_http_request.c
===================================================================
--- branches/stable-1.2/src/http/ngx_http_request.c	2012-11-13 11:00:37 UTC (rev 4907)
+++ branches/stable-1.2/src/http/ngx_http_request.c	2012-11-13 11:21:31 UTC (rev 4908)
@@ -2745,6 +2745,20 @@
             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;
     }
 



More information about the nginx-devel mailing list