Subversion
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
svn_pools.h
Go to the documentation of this file.
1 /**
2  * @copyright
3  * ====================================================================
4  * Copyright (c) 2000-2004, 2008 CollabNet. All rights reserved.
5  *
6  * This software is licensed as described in the file COPYING, which
7  * you should have received as part of this distribution. The terms
8  * are also available at http://subversion.tigris.org/license-1.html.
9  * If newer versions of this license are posted there, you may use a
10  * newer version instead, at your option.
11  *
12  * This software consists of voluntary contributions made by many
13  * individuals. For exact contribution history, see the revision
14  * history and logs, available at http://subversion.tigris.org/.
15  * ====================================================================
16  * @endcopyright
17  *
18  * @file svn_pools.h
19  * @brief APR pool management for Subversion
20  */
21 
22 
23 
24 
25 #ifndef SVN_POOLS_H
26 #define SVN_POOLS_H
27 
28 #include <apr_pools.h>
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif /* __cplusplus */
33 
34 
35 
36 /* Wrappers around APR pools, so we get debugging. */
37 
38 /** The recommended maximum amount of memory (4MB) to keep in an APR
39  * allocator on the free list, conveniently defined here to share
40  * between all our applications.
41  */
42 #define SVN_ALLOCATOR_RECOMMENDED_MAX_FREE (4096 * 1024)
43 
44 
45 /** Wrapper around apr_pool_create_ex(), with a simpler interface.
46  * The return pool will have an abort function set, which will call
47  * abort() on OOM.
48  */
49 apr_pool_t *
50 svn_pool_create_ex(apr_pool_t *parent_pool,
51  apr_allocator_t *allocator);
52 
53 #ifndef DOXYGEN_SHOULD_SKIP_THIS
54 apr_pool_t *
55 svn_pool_create_ex_debug(apr_pool_t *parent_pool,
56  apr_allocator_t *allocator,
57  const char *file_line);
58 
59 #if APR_POOL_DEBUG
60 #define svn_pool_create_ex(pool, allocator) \
61 svn_pool_create_ex_debug(pool, allocator, APR_POOL__FILE_LINE__)
62 
63 #endif /* APR_POOL_DEBUG */
64 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
65 
66 
67 /** Create a pool as a subpool of @a parent_pool */
68 #define svn_pool_create(parent_pool) svn_pool_create_ex(parent_pool, NULL)
69 
70 /** Clear a @a pool destroying its children.
71  *
72  * This define for @c svn_pool_clear exists for completeness.
73  */
74 #define svn_pool_clear apr_pool_clear
75 
76 
77 /** Destroy a @a pool and all of its children.
78  *
79  * This define for @c svn_pool_destroy exists for symmetry and
80  * completeness.
81  */
82 #define svn_pool_destroy apr_pool_destroy
83 
84 
85 #ifdef __cplusplus
86 }
87 #endif /* __cplusplus */
88 
89 #endif /* SVN_POOLS_H */