An STL node allocator that uses a modified DlMalloc as memory source. More...
#include <node_allocator.hpp>
Classes | |
struct | rebind |
Obtains node_allocator from node_allocator. More... | |
Public Types | |
typedef unsigned int | allocation_type |
If Version is 1, the allocator is a STL conforming allocator. More... | |
typedef node_allocator< T, NodesPerBlock, Version > | 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_STATIC_ASSERT ((Version<=2)) | |
node_allocator () BOOST_CONTAINER_NOEXCEPT | |
Default constructor. More... | |
node_allocator (const node_allocator &) BOOST_CONTAINER_NOEXCEPT | |
Copy constructor from other node_allocator. More... | |
template<class T2 > | |
node_allocator (const node_allocator< T2, NodesPerBlock, Version > &) BOOST_CONTAINER_NOEXCEPT | |
Copy constructor from related node_allocator. More... | |
~node_allocator () BOOST_CONTAINER_NOEXCEPT | |
Destructor. More... | |
size_type | max_size () const |
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 |
Friends | |
void | swap (self_t &, self_t &) BOOST_CONTAINER_NOEXCEPT |
Swaps allocators. More... | |
bool | operator== (const node_allocator &, const node_allocator &) 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 node_allocator &, const node_allocator &) 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 node_allocator with equal sizeof(T).
NodesPerBlock is the number of nodes allocated at once when the allocator runs out of nodes
typedef unsigned int boost::container::node_allocator< T, NodesPerBlock, Version >::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::node_allocator< T, NodesPerBlock, Version >::const_pointer |
typedef const ::boost::container:: container_detail::unvoid<T>::type& boost::container::node_allocator< T, NodesPerBlock, Version >::const_reference |
typedef std::ptrdiff_t boost::container::node_allocator< T, NodesPerBlock, Version >::difference_type |
typedef boost::container::container_detail:: transform_multiallocation_chain<multiallocation_chain_void, T> boost::container::node_allocator< T, NodesPerBlock, Version >::multiallocation_chain |
typedef boost::container::container_detail:: basic_multiallocation_chain<void*> boost::container::node_allocator< T, NodesPerBlock, Version >::multiallocation_chain_void |
typedef T* boost::container::node_allocator< T, NodesPerBlock, Version >::pointer |
typedef ::boost::container:: container_detail::unvoid<T>::type& boost::container::node_allocator< T, NodesPerBlock, Version >::reference |
typedef node_allocator<T, NodesPerBlock, Version> boost::container::node_allocator< T, NodesPerBlock, Version >::self_t |
typedef std::size_t boost::container::node_allocator< T, NodesPerBlock, Version >::size_type |
typedef T boost::container::node_allocator< T, NodesPerBlock, Version >::value_type |
typedef boost::container::container_detail:: version_type<self_t, Version> boost::container::node_allocator< T, NodesPerBlock, Version >::version |
|
inline |
Default constructor.
|
inline |
Copy constructor from other node_allocator.
|
inline |
Copy constructor from related node_allocator.
|
inline |
Destructor.
|
inline |
Allocate memory for an array of count elements.
Throws std::bad_alloc if there is no enough memory
References boost::container::node_allocator< T, NodesPerBlock, Version >::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 boost::container::node_allocator< T, NodesPerBlock, Version >::BOOST_STATIC_ASSERT(), and T.
|
inline |
Allocates many elements of size elem_size.
Elements must be individually deallocated with deallocate()
References boost::container::node_allocator< T, NodesPerBlock, Version >::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::container::node_allocator< T, NodesPerBlock, Version >::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 boost::container::node_allocator< T, NodesPerBlock, Version >::BOOST_STATIC_ASSERT(), and T.
|
inline |
boost::container::node_allocator< T, NodesPerBlock, Version >::BOOST_STATIC_ASSERT | ( | (Version<=2) | ) |
Referenced by boost::container::node_allocator< T, NodesPerBlock, Version >::allocate_individual(), boost::container::node_allocator< T, NodesPerBlock, Version >::allocate_many(), boost::container::node_allocator< T, NodesPerBlock, Version >::allocate_one(), boost::container::node_allocator< T, NodesPerBlock, Version >::allocation_command(), boost::container::node_allocator< T, NodesPerBlock, Version >::deallocate_individual(), boost::container::node_allocator< T, NodesPerBlock, Version >::deallocate_many(), boost::container::node_allocator< T, NodesPerBlock, Version >::deallocate_one(), and boost::container::node_allocator< T, NodesPerBlock, Version >::size().
|
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 |
|
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::container::node_allocator< T, NodesPerBlock, Version >::BOOST_STATIC_ASSERT(), boost::multiprecision::backends::p, and T.
|
inline |
Returns the number of elements that could be allocated.
Never throws
References T.
Referenced by boost::container::node_allocator< T, NodesPerBlock, Version >::allocate().
|
inline |
Returns maximum the number of objects the previously allocated memory pointed by p can hold.
References boost::container::node_allocator< T, NodesPerBlock, Version >::BOOST_STATIC_ASSERT(), and 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 |