From: Bill Stoddard Date: Thu, 20 Nov 2003 19:44:18 +0000 (+0000) Subject: Win32: Make Win32 MPM transaction pools honor MaxMemFree X-Git-Tag: pre_ajp_proxy~1034 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c5b83795918824402d4cbbea274312765e79e06b;p=thirdparty%2Fapache%2Fhttpd.git Win32: Make Win32 MPM transaction pools honor MaxMemFree PR: Obtained from: Submitted by: Reviewed by: git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@101817 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index e45250edf73..8352a5e3dbb 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,8 @@ Changes with Apache 2.1.0-dev [Remove entries to the current 2.0 section below, when backported] + *) Win32 MPM: The bucket brigades subsystem now honors the MaxMemFree setting. + [Bill Stoddard] *) mod_autoindex: new directive IndexStyleSheet [Tyler Riddle , Paul Querna ] diff --git a/server/mpm/winnt/child.c b/server/mpm/winnt/child.c index f1034f6c94d..d09633a6972 100644 --- a/server/mpm/winnt/child.c +++ b/server/mpm/winnt/child.c @@ -185,6 +185,8 @@ AP_DECLARE(PCOMP_CONTEXT) mpm_get_completion_context(void) * Multiple failures in the next two steps will cause the pchild pool * to 'leak' storage. I don't think this is worth fixing... */ + apr_allocator_t *allocator; + context = (PCOMP_CONTEXT) apr_pcalloc(pchild, sizeof(COMP_CONTEXT)); context->Overlapped.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL); @@ -196,13 +198,17 @@ AP_DECLARE(PCOMP_CONTEXT) mpm_get_completion_context(void) } /* Create the tranaction pool */ - if ((rv = apr_pool_create(&context->ptrans, pchild)) != APR_SUCCESS) { + apr_allocator_create(&allocator); + apr_allocator_max_free_set(allocator, ap_max_mem_free); + rv = apr_pool_create_ex(&context->ptrans, NULL, NULL, allocator); + if (rv != APR_SUCCESS) { ap_log_error(APLOG_MARK,APLOG_WARNING, rv, ap_server_conf, "mpm_get_completion_context: Failed to create the transaction pool."); CloseHandle(context->Overlapped.hEvent); return NULL; } - apr_pool_tag(context->ptrans, "ptrans"); + apr_allocator_owner_set(allocator, context->ptrans); + apr_pool_tag(context->ptrans, "transaction"); context->accept_socket = INVALID_SOCKET; context->ba = apr_bucket_alloc_create(pchild); @@ -437,9 +443,13 @@ static PCOMP_CONTEXT win9x_get_connection(PCOMP_CONTEXT context) if (context == NULL) { /* allocate the completion context and the transaction pool */ + apr_allocator_t *allocator; context = apr_pcalloc(pchild, sizeof(COMP_CONTEXT)); - apr_pool_create(&context->ptrans, pchild); - apr_pool_tag(context->ptrans, "ptrans"); + apr_allocator_create(&allocator); + apr_allocator_max_free_set(allocator, ap_max_mem_free); + apr_pool_create_ex(&context->ptrans, NULL, NULL, allocator); + apr_allocator_owner_set(allocator, context->ptrans); + apr_pool_tag(context->ptrans, "transaction"); context->ba = apr_bucket_alloc_create(pchild); } diff --git a/server/mpm/winnt/mpm.h b/server/mpm/winnt/mpm.h index 0c0825a0cb6..08bcf91f7c3 100644 --- a/server/mpm/winnt/mpm.h +++ b/server/mpm/winnt/mpm.h @@ -72,6 +72,7 @@ #define AP_MPM_WANT_SET_MAX_REQUESTS #define AP_MPM_WANT_SET_COREDUMPDIR #define AP_MPM_WANT_SET_SCOREBOARD +#define AP_MPM_WANT_SET_MAX_MEM_FREE extern int ap_threads_per_child; extern int ap_thread_limit;