httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bill Stoddard <b...@wstoddard.com>
Subject [PATCH] Enable MaxMemFree in Windows MPM
Date Wed, 12 Nov 2003 22:23:27 GMT
Warning... this patch -may- not apply to a fresh co of Apache 2 because I created the patch
on my hacked up 
local copy of 2.0.47. I'll not be able to follow up till next Monday at the earliest.

Bill

Index: server/mpm/winnt/child.c
===================================================================
RCS file: /cvs/phoenix/2.0.47/server/mpm/winnt/child.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 child.c
--- server/mpm/winnt/child.c	29 Jul 2003 20:19:25 -0000	1.1.1.1
+++ server/mpm/winnt/child.c	12 Nov 2003 21:53:10 -0000
@@ -185,6 +185,8 @@
                   * 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,17 +198,22 @@
                  }

                  /* 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);
                  apr_atomic_inc(&num_completion_contexts);
+
                  break;
              }
          } else {
@@ -437,9 +444,13 @@

      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);
      }

Index: server/mpm/winnt/mpm.h
===================================================================
RCS file: /cvs/phoenix/2.0.47/server/mpm/winnt/mpm.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 mpm.h
--- server/mpm/winnt/mpm.h	29 Jul 2003 20:19:25 -0000	1.1.1.1
+++ server/mpm/winnt/mpm.h	12 Nov 2003 21:36:57 -0000
@@ -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;



Mime
View raw message