From 936f40e27f278c38f26091f91423b7a4e6e56a59 Mon Sep 17 00:00:00 2001 From: Graham Leggett Date: Thu, 23 May 2013 14:28:41 +0000 Subject: [PATCH] core: Do not over allocate memory within 'ap_rgetline_core' for the common case. trunk patch: http://svn.apache.org/r1483005 Submitted by: jailletc36 Reviewed by: jim, minfrin git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1485728 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 3 +++ STATUS | 5 ----- server/protocol.c | 6 ------ 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/CHANGES b/CHANGES index 6dbdee954c..e641bad1e3 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,9 @@ Changes with Apache 2.4.5 + *) core: Do not over allocate memory within 'ap_rgetline_core' for + the common case. [Christophe Jaillet] + *) core: speed up (for common cases) and reduce memory usage of ap_escape_logitem(). This should save 70-100 bytes in the request pool for a default config. [Christophe Jaillet] diff --git a/STATUS b/STATUS index f8963546ae..7ca478c74c 100644 --- a/STATUS +++ b/STATUS @@ -90,11 +90,6 @@ RELEASE SHOWSTOPPERS: PATCHES ACCEPTED TO BACKPORT FROM TRUNK: [ start all new proposals below, under PATCHES PROPOSED. ] - * core: Do not over allocate memory within 'ap_rgetline_core' for the common case. - trunk patch: http://svn.apache.org/r1483005 - 2.4.x patch: trunk works - +1: jailletc36, jim, minfrin - PATCHES PROPOSED TO BACKPORT FROM TRUNK: [ New proposals should be added at the end of the list ] diff --git a/server/protocol.c b/server/protocol.c index c2b1f48cd8..a0b3246427 100644 --- a/server/protocol.c +++ b/server/protocol.c @@ -185,9 +185,6 @@ AP_DECLARE(apr_time_t) ap_rationalize_mtime(request_rec *r, apr_time_t mtime) return (mtime > now) ? now : mtime; } -/* Min # of bytes to allocate when reading a request line */ -#define MIN_LINE_ALLOC 80 - /* Get a line of protocol input, including any continuation lines * caused by MIME folding (or broken clients) if fold != 0, and place it * in the buffer s, of size n bytes, without the ending newline. @@ -286,9 +283,6 @@ AP_DECLARE(apr_status_t) ap_rgetline_core(char **s, apr_size_t n, /* We'll assume the common case where one bucket is enough. */ if (!*s) { current_alloc = len; - if (current_alloc < MIN_LINE_ALLOC) { - current_alloc = MIN_LINE_ALLOC; - } *s = apr_palloc(r->pool, current_alloc); } else if (bytes_handled + len > current_alloc) { -- 2.40.0