3 * ====================================================================
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
20 * ====================================================================
24 * @brief APR pool management for Subversion
33 #include "svn_types.h"
37 #endif /* __cplusplus */
41 /* Wrappers around APR pools, so we get debugging. */
43 /** The recommended maximum amount of memory (4MB) to keep in an APR
44 * allocator on the free list, conveniently defined here to share
45 * between all our applications.
47 #define SVN_ALLOCATOR_RECOMMENDED_MAX_FREE (4096 * 1024)
50 /** Wrapper around apr_pool_create_ex(), with a simpler interface.
51 * The return pool will have an abort function set, which will call
55 svn_pool_create_ex(apr_pool_t
*parent_pool
,
56 apr_allocator_t
*allocator
);
58 #ifndef DOXYGEN_SHOULD_SKIP_THIS
60 svn_pool_create_ex_debug(apr_pool_t
*parent_pool
,
61 apr_allocator_t
*allocator
,
62 const char *file_line
);
65 #define svn_pool_create_ex(pool, allocator) \
66 svn_pool_create_ex_debug(pool, allocator, APR_POOL__FILE_LINE__)
68 #endif /* APR_POOL_DEBUG */
69 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
72 /** Create a pool as a subpool of @a parent_pool */
73 #define svn_pool_create(parent_pool) svn_pool_create_ex(parent_pool, NULL)
75 /** Clear a @a pool destroying its children.
77 * This define for @c svn_pool_clear exists for completeness.
79 #define svn_pool_clear apr_pool_clear
82 /** Destroy a @a pool and all of its children.
84 * This define for @c svn_pool_destroy exists for symmetry and
87 #define svn_pool_destroy apr_pool_destroy
89 /** Return a new allocator. This function limits the unused memory in the
90 * new allocator to #SVN_ALLOCATOR_RECOMMENDED_MAX_FREE and ensures
91 * proper synchronization if the allocator is used by multiple threads.
93 * If your application uses multiple threads, creating a separate
94 * allocator for each of these threads may not be feasible. Set the
95 * @a thread_safe parameter to @c TRUE in that case; otherwise, set @a
96 * thread_safe to @c FALSE to maximize performance.
98 * @note Even if @a thread_safe is @c TRUE, pools themselves will
99 * still not be thread-safe and their access may require explicit
102 * To access the owner pool, which can also serve as the root pool for
103 * your sub-pools, call @c apr_allocator_get_owner().
108 svn_pool_create_allocator(svn_boolean_t thread_safe
);
112 #endif /* __cplusplus */
114 #endif /* SVN_POOLS_H */