Subversion
Macros | Functions
svn_pools.h File Reference

APR pool management for Subversion. More...

#include "svn_types.h"

Go to the source code of this file.

Macros

#define SVN_ALLOCATOR_RECOMMENDED_MAX_FREE   (4096 * 1024)
 The recommended maximum amount of memory (4MB) to keep in an APR allocator on the free list, conveniently defined here to share between all our applications.
 
#define svn_pool_create(parent_pool)   svn_pool_create_ex(parent_pool, NULL)
 Create a pool as a subpool of parent_pool.
 
#define svn_pool_clear   apr_pool_clear
 Clear a pool destroying its children. More...
 
#define svn_pool_destroy   apr_pool_destroy
 Destroy a pool and all of its children. More...
 

Functions

apr_pool_t * svn_pool_create_ex (apr_pool_t *parent_pool, apr_allocator_t *allocator)
 Wrapper around apr_pool_create_ex(), with a simpler interface. More...
 
apr_allocator_t * svn_pool_create_allocator (svn_boolean_t thread_safe)
 Return a new allocator. More...
 

Detailed Description

APR pool management for Subversion.

@if copyrights

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations

under the License.

Definition in file svn_pools.h.

Macro Definition Documentation

◆ svn_pool_clear

#define svn_pool_clear   apr_pool_clear

Clear a pool destroying its children.

This define for svn_pool_clear exists for completeness.

Definition at line 79 of file svn_pools.h.

◆ svn_pool_destroy

#define svn_pool_destroy   apr_pool_destroy

Destroy a pool and all of its children.

This define for svn_pool_destroy exists for symmetry and completeness.

Definition at line 87 of file svn_pools.h.

Function Documentation

◆ svn_pool_create_allocator()

apr_allocator_t* svn_pool_create_allocator ( svn_boolean_t  thread_safe)

Return a new allocator.

This function limits the unused memory in the new allocator to SVN_ALLOCATOR_RECOMMENDED_MAX_FREE and ensures proper synchronization if the allocator is used by multiple threads.

If your application uses multiple threads, creating a separate allocator for each of these threads may not be feasible. Set the thread_safe parameter to TRUE in that case; otherwise, set thread_safe to FALSE to maximize performance.

Note
Even if thread_safe is TRUE, pools themselves will still not be thread-safe and their access may require explicit serialization.

To access the owner pool, which can also serve as the root pool for your sub-pools, call apr_allocator_get_owner().

Since
: New in 1.8

◆ svn_pool_create_ex()

apr_pool_t* svn_pool_create_ex ( apr_pool_t *  parent_pool,
apr_allocator_t *  allocator 
)

Wrapper around apr_pool_create_ex(), with a simpler interface.

The return pool will have an abort function set, which will call abort() on OOM.