Changes with Apache 2.0.40
+ *) Add a new directive: MaxMemFree. MaxMemFree makes it possible
+ to configure the maximum amount of memory the allocators will
+ hold on to for reuse. Anything over the MaxMemFree threshold
+ will be free()d. This directive is usefull when uncommon large
+ peaks occur in memory usage. It should _not_ be used to mask
+ defective modules' memory use. [Sander Striker]
*) Fixed the Content-Length filter so that HTTP/1.0 requests to CGI
scripts would not result in a truncated response.
AP_INIT_TAKE1("AcceptMutex", ap_mpm_set_accept_lock_mech, NULL, RSRC_CONF, \
ap_valid_accept_mutex_string),
#endif
+#ifdef AP_MPM_WANT_SET_MAX_MEM_FREE
+AP_INIT_TAKE1("MaxMemFree", ap_mpm_set_max_mem_free, NULL, RSRC_CONF,\
+ "Maximum number of 1k blocks a particular childs allocator may hold."),
+#endif
{ NULL }
};
sigprocmask(SIG_BLOCK, &sig_mask, NULL);
apr_allocator_create(&allocator);
+ apr_allocator_max_free_set(allocator, ap_max_mem_free);
apr_pool_create_ex(&ptrans, tpool, NULL, allocator);
apr_allocator_owner_set(allocator, ptrans);
#define AP_MPM_WANT_SET_SCOREBOARD
#define AP_MPM_WANT_SET_MAX_REQUESTS
#define AP_MPM_WANT_SET_COREDUMPDIR
+#define AP_MPM_WANT_SET_MAX_MEM_FREE
extern int ap_max_child_assigned;
extern server_rec *ap_server_conf;
free(ti);
apr_allocator_create(&allocator);
+ apr_allocator_max_free_set(allocator, ap_max_mem_free);
apr_pool_create_ex(&ptrans, NULL, NULL, allocator);
apr_allocator_owner_set(allocator, ptrans);
bucket_alloc = apr_bucket_alloc_create(tpool);
#define AP_MPM_WANT_SET_MAX_REQUESTS
#define AP_MPM_WANT_SET_COREDUMPDIR
#define AP_MPM_WANT_SET_ACCEPT_LOCK_MECH
+#define AP_MPM_WANT_SET_MAX_MEM_FREE
#define AP_MPM_DISABLE_NAGLE_ACCEPTED_SOCK
#define AP_MPM_USES_POD 1
#define AP_MPM_WANT_SET_COREDUMPDIR
#define AP_MPM_WANT_SET_ACCEPT_LOCK_MECH
#define AP_MPM_WANT_SIGNAL_SERVER
+#define AP_MPM_WANT_SET_MAX_MEM_FREE
#define AP_MPM_DISABLE_NAGLE_ACCEPTED_SOCK
#define MPM_CHILD_PID(i) (ap_scoreboard_image->parent[i].pid)
ap_update_child_status_from_indexes(process_slot, thread_slot, SERVER_STARTING, NULL);
apr_allocator_create(&allocator);
+ apr_allocator_max_free_set(allocator, ap_max_mem_free);
apr_pool_create_ex(&ptrans, NULL, NULL, allocator);
apr_allocator_owner_set(allocator, ptrans);
#define AP_MPM_WANT_SET_LOCKFILE
*/
#define AP_MPM_WANT_SET_MAX_REQUESTS
+#define AP_MPM_WANT_SET_MAX_MEM_FREE
#define AP_MPM_DISABLE_NAGLE_ACCEPTED_SOCK
/*#define AP_MPM_WANT_SET_COREDUMPDIR
#define AP_MPM_WANT_SET_ACCEPT_LOCK_MECH
tv.tv_usec = 0;
apr_allocator_create(&allocator);
+ apr_allocator_max_free_set(allocator, ap_max_mem_free);
apr_pool_create_ex(&ptrans, NULL, NULL, allocator);
apr_allocator_owner_set(allocator, ptrans);
apr_pool_tag(ptrans, "transaction");
#define AP_MPM_WANT_SET_COREDUMPDIR
#define AP_MPM_WANT_SET_ACCEPT_LOCK_MECH
#define AP_MPM_WANT_SIGNAL_SERVER
+#define AP_MPM_WANT_SET_MAX_MEM_FREE
#define AP_MPM_DISABLE_NAGLE_ACCEPTED_SOCK
#define AP_MPM_USES_POD 1
* we can have cleanups occur when the child exits.
*/
apr_allocator_create(&allocator);
+ apr_allocator_max_free_set(allocator, ap_max_mem_free);
apr_pool_create_ex(&pchild, pconf, NULL, allocator);
apr_allocator_owner_set(allocator, pchild);
#define AP_MPM_WANT_SET_COREDUMPDIR
#define AP_MPM_WANT_SET_ACCEPT_LOCK_MECH
#define AP_MPM_WANT_SIGNAL_SERVER
+#define AP_MPM_WANT_SET_MAX_MEM_FREE
#define AP_MPM_DISABLE_NAGLE_ACCEPTED_SOCK
#define MPM_CHILD_PID(i) (ap_scoreboard_image->parent[i].pid)
apr_allocator_t *allocator;
apr_allocator_create(&allocator);
+ apr_allocator_max_free_set(allocator, ap_max_mem_free);
apr_pool_create_ex(&ptrans, NULL, NULL, allocator);
apr_allocator_owner_set(allocator, ptrans);
}
#endif /* AP_MPM_WANT_SIGNAL_SERVER */
+#ifdef AP_MPM_WANT_SET_MAX_MEM_FREE
+apr_uint32_t ap_max_mem_free = 0;
+
+const char *ap_mpm_set_max_mem_free(cmd_parms *cmd, void *dummy,
+ const char *arg)
+{
+ long value;
+ const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
+ if (err != NULL) {
+ return err;
+ }
+
+ value = strtol(arg, NULL, 0);
+ if (value < 0 || errno == ERANGE)
+ return apr_pstrcat(cmd->pool, "Invalid MaxMemFree value: ",
+ arg, NULL);
+
+ ap_max_mem_free = (apr_uint32_t)value * 1024;
+
+ return NULL;
+}
+
+#endif /* AP_MPM_WANT_SET_MAX_MEM_FREE */