This class implements an algorithm that stores the free nodes in a red-black tree to have logarithmic search/insert times. More...
#include <rbtree_best_fit.hpp>
Public Types | |
typedef MutexFamily | mutex_family |
Shared mutex family used for the rest of the Interprocess framework. More... | |
typedef VoidPointer | void_pointer |
Pointer type to be used with the rest of the Interprocess framework. More... | |
typedef ipcdetail::basic_multiallocation_chain < VoidPointer > | multiallocation_chain |
typedef boost::intrusive::pointer_traits < char_ptr >::difference_type | difference_type |
typedef boost::make_unsigned < difference_type >::type | size_type |
Public Member Functions | |
rbtree_best_fit (size_type size, size_type extra_hdr_bytes) | |
Constructor. More... | |
~rbtree_best_fit () | |
Destructor. More... | |
void * | allocate (size_type nbytes) |
Allocates bytes, returns 0 if there is not more memory. More... | |
void | allocate_many (size_type elem_bytes, size_type num_elements, multiallocation_chain &chain) |
Multiple element allocation, same size. More... | |
void | allocate_many (const size_type *elem_sizes, size_type n_elements, size_type sizeof_element, multiallocation_chain &chain) |
Multiple element allocation, different size. More... | |
void | deallocate_many (multiallocation_chain &chain) |
Multiple element allocation, different size. More... | |
void | deallocate (void *addr) |
Deallocates previously allocated bytes. More... | |
size_type | get_size () const |
Returns the size of the memory segment. More... | |
size_type | get_free_memory () const |
Returns the number of free bytes of the segment. More... | |
void | zero_free_memory () |
Initializes to zero all the memory that's not in use. More... | |
void | grow (size_type extra_size) |
Increases managed memory in extra_size bytes more. More... | |
void | shrink_to_fit () |
Decreases managed memory as much as possible. More... | |
bool | all_memory_deallocated () |
Returns true if all allocated memory has been deallocated. More... | |
bool | check_sanity () |
Makes an internal sanity check and returns true if success. More... | |
template<class T > | |
std::pair< T *, bool > | allocation_command (boost::interprocess::allocation_type command, size_type limit_size, size_type preferred_size, size_type &received_size, T *reuse_ptr=0) |
std::pair< void *, bool > | raw_allocation_command (boost::interprocess::allocation_type command, size_type limit_object, size_type preferred_object, size_type &received_object, void *reuse_ptr=0, size_type sizeof_object=1) |
size_type | size (const void *ptr) const |
Returns the size of the buffer previously allocated pointed by ptr. More... | |
void * | allocate_aligned (size_type nbytes, size_type alignment) |
Allocates aligned bytes, returns 0 if there is not more memory. More... | |
Static Public Member Functions | |
static size_type | get_min_size (size_type extra_hdr_bytes) |
Obtains the minimum size needed by the algorithm. More... | |
Static Public Attributes | |
static const size_type | Alignment |
static const size_type | PayloadPerAllocation = AllocatedCtrlBytes - UsableByPreviousChunk |
Friends | |
class | ipcdetail::memory_algorithm_common< rbtree_best_fit > |
This class implements an algorithm that stores the free nodes in a red-black tree to have logarithmic search/insert times.
typedef boost::intrusive::pointer_traits<char_ptr>::difference_type boost::interprocess::rbtree_best_fit< MutexFamily, VoidPointer, MemAlignment >::difference_type |
typedef ipcdetail::basic_multiallocation_chain<VoidPointer> boost::interprocess::rbtree_best_fit< MutexFamily, VoidPointer, MemAlignment >::multiallocation_chain |
typedef MutexFamily boost::interprocess::rbtree_best_fit< MutexFamily, VoidPointer, MemAlignment >::mutex_family |
Shared mutex family used for the rest of the Interprocess framework.
typedef boost::make_unsigned<difference_type>::type boost::interprocess::rbtree_best_fit< MutexFamily, VoidPointer, MemAlignment >::size_type |
typedef VoidPointer boost::interprocess::rbtree_best_fit< MutexFamily, VoidPointer, MemAlignment >::void_pointer |
Pointer type to be used with the rest of the Interprocess framework.
|
inline |
Constructor.
"size" is the total size of the managed memory segment, "extra_hdr_bytes" indicates the extra bytes beginning in the sizeof(rbtree_best_fit) offset that the allocator should not use at all.
References BOOST_ASSERT.
|
inline |
Destructor.
|
inline |
Returns true if all allocated memory has been deallocated.
|
inline |
Allocates bytes, returns 0 if there is not more memory.
|
inline |
Allocates aligned bytes, returns 0 if there is not more memory.
Alignment must be power of 2
|
inline |
Multiple element allocation, same size.
|
inline |
Multiple element allocation, different size.
|
inline |
References BOOST_ASSERT, and T.
bool boost::interprocess::rbtree_best_fit< MutexFamily, VoidPointer, MemAlignment >::check_sanity | ( | ) |
Makes an internal sanity check and returns true if success.
void boost::interprocess::rbtree_best_fit< MutexFamily, VoidPointer, MemAlignment >::deallocate | ( | void * | addr | ) |
Deallocates previously allocated bytes.
|
inline |
Multiple element allocation, different size.
rbtree_best_fit< MutexFamily, VoidPointer, MemAlignment >::size_type boost::interprocess::rbtree_best_fit< MutexFamily, VoidPointer, MemAlignment >::get_free_memory | ( | ) | const |
Returns the number of free bytes of the segment.
|
static |
Obtains the minimum size needed by the algorithm.
|
inline |
Returns the size of the memory segment.
void boost::interprocess::rbtree_best_fit< MutexFamily, VoidPointer, MemAlignment >::grow | ( | size_type | extra_size | ) |
Increases managed memory in extra_size bytes more.
References BOOST_ASSERT, and boost::multiprecision::backends::this.
|
inline |
References boost::sinks::event_log::success.
void boost::interprocess::rbtree_best_fit< MutexFamily, VoidPointer, MemAlignment >::shrink_to_fit | ( | ) |
Decreases managed memory as much as possible.
References BOOST_ASSERT, and boost::detail::void.
rbtree_best_fit< MutexFamily, VoidPointer, MemAlignment >::size_type boost::interprocess::rbtree_best_fit< MutexFamily, VoidPointer, MemAlignment >::size | ( | const void * | ptr | ) | const |
Returns the size of the buffer previously allocated pointed by ptr.
|
inline |
Initializes to zero all the memory that's not in use.
This function is normally used for security reasons.
References boost::python::ptr(), and boost::asio::s.
|
friend |
|
static |
|
static |