summaryrefslogtreecommitdiff
path: root/memory
diff options
context:
space:
mode:
authorYann Ylavic <ylavic@apache.org>2017-03-24 08:19:41 +0000
committerYann Ylavic <ylavic@apache.org>2017-03-24 08:19:41 +0000
commit561d79621b805afa1b6531442592c02bb7e51a25 (patch)
tree9950a2fa37b1c7e4aee6cbd83d0ead61f911e8ab /memory
parent84f3ecfc5ffbe4074e73cf3824fd6ba5c4986fe0 (diff)
downloadapr-561d79621b805afa1b6531442592c02bb7e51a25.tar.gz
Follow up to r1788346: we don't really need a separate "order" setting for
allocators and pools, so axe apr_pool_alloc_order_set(). git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1788376 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'memory')
-rw-r--r--memory/unix/apr_pools.c37
1 files changed, 11 insertions, 26 deletions
diff --git a/memory/unix/apr_pools.c b/memory/unix/apr_pools.c
index 79c7eae0e..e3d82d0f7 100644
--- a/memory/unix/apr_pools.c
+++ b/memory/unix/apr_pools.c
@@ -63,10 +63,14 @@ int apr_running_on_valgrind = 0;
*/
/*
- * Recycle up to MAX_INDEX in slots, larger indexes go to
- * the sink slot at MAX_INDEX.
+ * Recycle up to MAX_INDEX in slots, larger indexes go to the
+ * sink slot at MAX_INDEX, and allocate at least MIN_ALLOC
+ * bytes (2^order boundaries/pages).
*/
#define MAX_INDEX 20
+#define MAX_ORDER 9
+static unsigned int min_order = 1;
+#define MIN_ALLOC (BOUNDARY_SIZE << min_order)
/*
* Determines the boundary/page size.
@@ -91,16 +95,6 @@ static unsigned int boundary_size;
#define GUARDPAGE_SIZE 0
#endif /* APR_ALLOCATOR_GUARD_PAGES */
-/*
- * Allocate at least MIN_ALLOC bytes (2^order boundaries/pages),
- * and POOL_SIZE bytes for each pool.
- */
-#define MAX_ALLOC_ORDER 9
-static unsigned int min_alloc_order = 1;
-#define MIN_ALLOC (BOUNDARY_SIZE << min_alloc_order)
-static unsigned int pool_alloc_order = 1;
-#define POOL_SIZE (BOUNDARY_SIZE << pool_alloc_order)
-
/*
* Timing constants for killing subprocesses
* There is a total 3-second delay between sending a SIGINT
@@ -529,19 +523,10 @@ APR_DECLARE(apr_size_t) apr_allocator_page_size(void)
APR_DECLARE(apr_status_t) apr_allocator_min_order_set(unsigned int order)
{
- if (order > MAX_ALLOC_ORDER) {
- return APR_EINVAL;
- }
- min_alloc_order = order;
- return APR_SUCCESS;
-}
-
-APR_DECLARE(apr_status_t) apr_pool_alloc_order_set(unsigned int order)
-{
- if (order > MAX_ALLOC_ORDER) {
+ if (order > MAX_ORDER) {
return APR_EINVAL;
}
- pool_alloc_order = order;
+ min_order = order;
return APR_SUCCESS;
}
@@ -1112,7 +1097,7 @@ APR_DECLARE(apr_status_t) apr_pool_create_ex(apr_pool_t **newpool,
allocator = parent->allocator;
if ((node = allocator_alloc(allocator,
- POOL_SIZE - APR_MEMNODE_T_SIZE)) == NULL) {
+ MIN_ALLOC - APR_MEMNODE_T_SIZE)) == NULL) {
if (abort_fn)
abort_fn(APR_ENOMEM);
@@ -1206,7 +1191,7 @@ APR_DECLARE(apr_status_t) apr_pool_create_unmanaged_ex(apr_pool_t **newpool,
return APR_ENOMEM;
}
if ((node = allocator_alloc(pool_allocator,
- POOL_SIZE - APR_MEMNODE_T_SIZE)) == NULL) {
+ MIN_ALLOC - APR_MEMNODE_T_SIZE)) == NULL) {
if (abort_fn)
abort_fn(APR_ENOMEM);
@@ -1214,7 +1199,7 @@ APR_DECLARE(apr_status_t) apr_pool_create_unmanaged_ex(apr_pool_t **newpool,
}
}
else if ((node = allocator_alloc(pool_allocator,
- POOL_SIZE - APR_MEMNODE_T_SIZE)) == NULL) {
+ MIN_ALLOC - APR_MEMNODE_T_SIZE)) == NULL) {
if (abort_fn)
abort_fn(APR_ENOMEM);