An STL node allocator that uses a modified DLMalloc as memory source. More...
#include <container_fwd.hpp>
Classes | |
struct | rebind |
Obtains adaptive_pool from adaptive_pool. More... | |
Public Types | |
typedef unsigned int | allocation_type |
If Version is 1, the allocator is a STL conforming allocator. More... | |
typedef adaptive_pool< T, NodesPerBlock, MaxFreeBlocks, OverheadPercent > | self_t |
typedef T | value_type |
typedef T * | pointer |
typedef const T * | const_pointer |
typedef ::boost::container::container_detail::unvoid < T >::type & | reference |
typedef const ::boost::container::container_detail::unvoid < T >::type & | const_reference |
typedef std::size_t | size_type |
typedef std::ptrdiff_t | difference_type |
typedef boost::container::container_detail::version_type < self_t, Version > | version |
typedef boost::container::container_detail::basic_multiallocation_chain < void * > | multiallocation_chain_void |
typedef boost::container::container_detail::transform_multiallocation_chain < multiallocation_chain_void, T > | multiallocation_chain |
Public Member Functions | |
BOOST_CONTAINER_DOCIGN (BOOST_STATIC_ASSERT((Version<=2))) | |
adaptive_pool () BOOST_CONTAINER_NOEXCEPT | |
Default constructor. More... | |
adaptive_pool (const adaptive_pool &) BOOST_CONTAINER_NOEXCEPT | |
Copy constructor from other adaptive_pool. More... | |
template<class T2 > | |
adaptive_pool (const adaptive_pool< T2, NodesPerBlock, MaxFreeBlocks, OverheadPercent BOOST_CONTAINER_DOCIGN(BOOST_CONTAINER_I Version)> &) BOOST_CONTAINER_NOEXCEPT | |
Copy constructor from related adaptive_pool. More... | |
~adaptive_pool () BOOST_CONTAINER_NOEXCEPT | |
Destructor. More... | |
size_type | max_size () const BOOST_CONTAINER_NOEXCEPT |
Returns the number of elements that could be allocated. More... | |
pointer | allocate (size_type count, const void *=0) |
Allocate memory for an array of count elements. More... | |
void | deallocate (const pointer &ptr, size_type count) BOOST_CONTAINER_NOEXCEPT |
Deallocate allocated memory. More... | |
std::pair< pointer, bool > | allocation_command (allocation_type command, size_type limit_size, size_type preferred_size, size_type &received_size, pointer reuse=pointer()) |
size_type | size (pointer p) const BOOST_CONTAINER_NOEXCEPT |
Returns maximum the number of objects the previously allocated memory pointed by p can hold. More... | |
pointer | allocate_one () |
Allocates just one object. More... | |
void | allocate_individual (std::size_t num_elements, multiallocation_chain &chain) |
Allocates many elements of size == 1. More... | |
void | deallocate_one (pointer p) BOOST_CONTAINER_NOEXCEPT |
Deallocates memory previously allocated with allocate_one(). More... | |
void | deallocate_individual (multiallocation_chain &chain) BOOST_CONTAINER_NOEXCEPT |
void | allocate_many (size_type elem_size, std::size_t n_elements, multiallocation_chain &chain) |
Allocates many elements of size elem_size. More... | |
void | allocate_many (const size_type *elem_sizes, size_type n_elements, multiallocation_chain &chain) |
Allocates n_elements elements, each one of size elem_sizes[i] Elements must be individually deallocated with deallocate() More... | |
void | deallocate_many (multiallocation_chain &chain) BOOST_CONTAINER_NOEXCEPT |
Static Public Member Functions | |
static void | deallocate_free_blocks () BOOST_CONTAINER_NOEXCEPT |
Deallocates all free blocks of the pool. More... | |
Static Public Attributes | |
static const std::size_t | nodes_per_block = NodesPerBlock |
static const std::size_t | max_free_blocks = MaxFreeBlocks |
static const std::size_t | overhead_percent = OverheadPercent |
static const std::size_t | real_nodes_per_block = NodesPerBlock |
Friends | |
void | swap (adaptive_pool &, adaptive_pool &) BOOST_CONTAINER_NOEXCEPT |
Swaps allocators. More... | |
bool | operator== (const adaptive_pool &, const adaptive_pool &) BOOST_CONTAINER_NOEXCEPT |
An allocator always compares to true, as memory allocated with one instance can be deallocated by another instance. More... | |
bool | operator!= (const adaptive_pool &, const adaptive_pool &) BOOST_CONTAINER_NOEXCEPT |
An allocator always compares to false, as memory allocated with one instance can be deallocated by another instance. More... | |
An STL node allocator that uses a modified DLMalloc as memory source.
This node allocator shares a segregated storage between all instances of adaptive_pool with equal sizeof(T).
NodesPerBlock is the number of nodes allocated at once when the allocator needs runs out of nodes. MaxFreeBlocks is the maximum number of totally free blocks that the adaptive node pool will hold. The rest of the totally free blocks will be deallocated to the memory manager.
OverheadPercent is the (approximated) maximum size overhead (1-20%) of the allocator: (memory usable for nodes / total memory allocated from the memory allocator)
typedef unsigned int boost::container::adaptive_pool< T, BOOST_CONTAINER_DOCONLY, BOOST_CONTAINER_DOCONLY, BOOST_CONTAINER_DOCONLY >::allocation_type |
If Version is 1, the allocator is a STL conforming allocator.
If Version is 2, the allocator offers advanced expand in place and burst allocation capabilities.
typedef const T* boost::container::adaptive_pool< T, BOOST_CONTAINER_DOCONLY, BOOST_CONTAINER_DOCONLY, BOOST_CONTAINER_DOCONLY >::const_pointer |
typedef const ::boost::container:: container_detail::unvoid<T>::type& boost::container::adaptive_pool< T, BOOST_CONTAINER_DOCONLY, BOOST_CONTAINER_DOCONLY, BOOST_CONTAINER_DOCONLY >::const_reference |
typedef std::ptrdiff_t boost::container::adaptive_pool< T, BOOST_CONTAINER_DOCONLY, BOOST_CONTAINER_DOCONLY, BOOST_CONTAINER_DOCONLY >::difference_type |
typedef boost::container::container_detail:: transform_multiallocation_chain<multiallocation_chain_void, T> boost::container::adaptive_pool< T, BOOST_CONTAINER_DOCONLY, BOOST_CONTAINER_DOCONLY, BOOST_CONTAINER_DOCONLY >::multiallocation_chain |
typedef boost::container::container_detail:: basic_multiallocation_chain<void*> boost::container::adaptive_pool< T, BOOST_CONTAINER_DOCONLY, BOOST_CONTAINER_DOCONLY, BOOST_CONTAINER_DOCONLY >::multiallocation_chain_void |
typedef T* boost::container::adaptive_pool< T, BOOST_CONTAINER_DOCONLY, BOOST_CONTAINER_DOCONLY, BOOST_CONTAINER_DOCONLY >::pointer |
typedef ::boost::container:: container_detail::unvoid<T>::type& boost::container::adaptive_pool< T, BOOST_CONTAINER_DOCONLY, BOOST_CONTAINER_DOCONLY, BOOST_CONTAINER_DOCONLY >::reference |
typedef adaptive_pool<T, NodesPerBlock, MaxFreeBlocks, OverheadPercent > boost::container::adaptive_pool< T, BOOST_CONTAINER_DOCONLY, BOOST_CONTAINER_DOCONLY, BOOST_CONTAINER_DOCONLY >::self_t |
typedef std::size_t boost::container::adaptive_pool< T, BOOST_CONTAINER_DOCONLY, BOOST_CONTAINER_DOCONLY, BOOST_CONTAINER_DOCONLY >::size_type |
typedef T boost::container::adaptive_pool< T, BOOST_CONTAINER_DOCONLY, BOOST_CONTAINER_DOCONLY, BOOST_CONTAINER_DOCONLY >::value_type |
typedef boost::container::container_detail:: version_type<self_t, Version> boost::container::adaptive_pool< T, BOOST_CONTAINER_DOCONLY, BOOST_CONTAINER_DOCONLY, BOOST_CONTAINER_DOCONLY >::version |
|
inline |
Default constructor.
|
inline |
Copy constructor from other adaptive_pool.
|
inline |
Copy constructor from related adaptive_pool.
|
inline |
Destructor.
|
inline |
Allocate memory for an array of count elements.
Throws std::bad_alloc if there is no enough memory
References boost::container::adaptive_pool< T, BOOST_CONTAINER_DOCONLY, BOOST_CONTAINER_DOCONLY, BOOST_CONTAINER_DOCONLY >::max_size(), T, and boost::container::throw_bad_alloc().
|
inline |
Allocates many elements of size == 1.
Elements must be individually deallocated with deallocate_one()
References T.
|
inline |
Allocates many elements of size elem_size.
Elements must be individually deallocated with deallocate()
References boost::BOOST_STATIC_ASSERT(), and boost::container::throw_bad_alloc().
|
inline |
Allocates n_elements elements, each one of size elem_sizes[i] Elements must be individually deallocated with deallocate()
References boost::BOOST_STATIC_ASSERT(), and boost::container::throw_bad_alloc().
|
inline |
Allocates just one object.
Memory allocated with this function must be deallocated only with deallocate_one(). Throws bad_alloc if there is no enough memory
References T.
|
inline |
References boost::container::throw_bad_alloc().
boost::container::adaptive_pool< T, BOOST_CONTAINER_DOCONLY, BOOST_CONTAINER_DOCONLY, BOOST_CONTAINER_DOCONLY >::BOOST_CONTAINER_DOCIGN | ( | BOOST_STATIC_ASSERT((Version<=2)) | ) |
|
inline |
Deallocate allocated memory.
Never throws
References count, boost::python::ptr(), T, and boost::detail::void.
|
inlinestatic |
Deallocates all free blocks of the pool.
References T.
|
inline |
References T.
|
inline |
|
inline |
Deallocates memory previously allocated with allocate_one().
You should never use deallocate_one to deallocate memory allocated with other functions different from allocate_one(). Never throws
References boost::multiprecision::backends::p, and T.
|
inline |
Returns the number of elements that could be allocated.
Never throws
References T.
Referenced by boost::container::adaptive_pool< T, BOOST_CONTAINER_DOCONLY, BOOST_CONTAINER_DOCONLY, BOOST_CONTAINER_DOCONLY >::allocate().
|
inline |
Returns maximum the number of objects the previously allocated memory pointed by p can hold.
References boost::multiprecision::backends::p.
|
friend |
An allocator always compares to false, as memory allocated with one instance can be deallocated by another instance.
|
friend |
An allocator always compares to true, as memory allocated with one instance can be deallocated by another instance.
|
friend |
Swaps allocators.
Does not throw. If each allocator is placed in a different memory segment, the result is undefined.
|
static |
|
static |
|
static |
|
static |