]> git.kaiwu.me - nginx.git/commitdiff
ngx_http_keepalive_handler() is now trying to not keep c->buffer's memory for
authorValentin Bartenev <vbart@nginx.com>
Tue, 23 Oct 2012 14:36:18 +0000 (14:36 +0000)
committerValentin Bartenev <vbart@nginx.com>
Tue, 23 Oct 2012 14:36:18 +0000 (14:36 +0000)
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).

src/http/ngx_http_request.c

index ec9d4a1c36397a26c5450972be1611f9ff49f9b7..ef010ff573fc6ab3120586407c67def6b317f19a 100644 (file)
@@ -2753,6 +2753,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;
     }