This object is the public base class of segment manager. More...
#include <segment_manager.hpp>
Public Types | |
typedef segment_manager_base < MemoryAlgorithm > | segment_manager_base_type |
typedef MemoryAlgorithm::void_pointer | void_pointer |
typedef MemoryAlgorithm::mutex_family | mutex_family |
typedef MemoryAlgorithm | memory_algorithm |
typedef MemoryAlgorithm::multiallocation_chain | multiallocation_chain |
typedef MemoryAlgorithm::difference_type | difference_type |
typedef MemoryAlgorithm::size_type | size_type |
Public Member Functions | |
segment_manager_base (size_type sz, size_type reserved_bytes) | |
Constructor of the segment_manager_base. 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 memory segment. More... | |
void * | allocate (size_type nbytes, std::nothrow_t) |
Allocates nbytes bytes. More... | |
void | allocate_many (size_type elem_bytes, size_type n_elements, multiallocation_chain &chain) |
Allocates n_elements of elem_bytes bytes. More... | |
void | allocate_many (const size_type *element_lengths, size_type n_elements, size_type sizeof_element, multiallocation_chain &chain) |
Allocates n_elements, each one of element_lengths[i]*sizeof_element bytes. More... | |
void | allocate_many (std::nothrow_t, size_type elem_bytes, size_type n_elements, multiallocation_chain &chain) |
Allocates n_elements of elem_bytes bytes. More... | |
void | allocate_many (std::nothrow_t, const size_type *elem_sizes, size_type n_elements, size_type sizeof_element, multiallocation_chain &chain) |
Allocates n_elements, each one of element_lengths[i]*sizeof_element bytes. More... | |
void | deallocate_many (multiallocation_chain &chain) |
Deallocates all elements contained in chain. More... | |
void * | allocate (size_type nbytes) |
Allocates nbytes bytes. More... | |
void * | allocate_aligned (size_type nbytes, size_type alignment, std::nothrow_t) |
Allocates nbytes bytes. More... | |
void * | allocate_aligned (size_type nbytes, size_type alignment) |
Allocates nbytes bytes. 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_objects, size_type preferred_objects, size_type &received_objects, void *reuse_ptr=0, size_type sizeof_object=1) |
void | deallocate (void *addr) |
Deallocates the bytes allocated with allocate/allocate_many() pointed by addr. More... | |
void | grow (size_type extra_size) |
Increases managed memory in extra_size bytes more. More... | |
void | shrink_to_fit () |
Decreases managed memory to the minimum. More... | |
bool | all_memory_deallocated () |
Returns the result of "all_memory_deallocated()" function of the used memory algorithm. More... | |
bool | check_sanity () |
Returns the result of "check_sanity()" function of the used memory algorithm. More... | |
void | zero_free_memory () |
Writes to zero free memory (memory not yet allocated) of the memory algorithm. More... | |
size_type | size (const void *ptr) const |
Returns the size of the buffer previously allocated pointed by ptr. More... | |
Static Public Member Functions | |
static size_type | get_min_size (size_type size) |
Obtains the minimum size needed by the segment manager. More... | |
Static Public Attributes | |
static const size_type | PayloadPerAllocation = MemoryAlgorithm::PayloadPerAllocation |
This constant indicates the payload size associated with each allocation of the memory algorithm. More... | |
Protected Member Functions | |
void * | prot_anonymous_construct (size_type num, bool dothrow, ipcdetail::in_place_interface &table) |
void | prot_anonymous_destroy (const void *object, ipcdetail::in_place_interface &table) |
Calls the destructor and makes an anonymous deallocate. More... | |
This object is the public base class of segment manager.
This class only depends on the memory allocation algorithm and implements all the allocation features not related to named or unique objects.
Storing a reference to segment_manager forces the holder class to be dependent on index types and character types. When such dependence is not desirable and only anonymous and raw allocations are needed, segment_manager_base is the correct answer.
typedef MemoryAlgorithm::difference_type boost::interprocess::segment_manager_base< MemoryAlgorithm >::difference_type |
typedef MemoryAlgorithm boost::interprocess::segment_manager_base< MemoryAlgorithm >::memory_algorithm |
typedef MemoryAlgorithm::multiallocation_chain boost::interprocess::segment_manager_base< MemoryAlgorithm >::multiallocation_chain |
typedef MemoryAlgorithm::mutex_family boost::interprocess::segment_manager_base< MemoryAlgorithm >::mutex_family |
typedef segment_manager_base<MemoryAlgorithm> boost::interprocess::segment_manager_base< MemoryAlgorithm >::segment_manager_base_type |
typedef MemoryAlgorithm::size_type boost::interprocess::segment_manager_base< MemoryAlgorithm >::size_type |
typedef MemoryAlgorithm::void_pointer boost::interprocess::segment_manager_base< MemoryAlgorithm >::void_pointer |
|
inline |
Constructor of the segment_manager_base.
"size" is the size of the memory segment where the basic segment manager is being constructed.
"reserved_bytes" is the number of bytes after the end of the memory algorithm object itself that the memory algorithm will exclude from dynamic allocation
Can throw
References BOOST_ASSERT.
|
inline |
Returns the result of "all_memory_deallocated()" function of the used memory algorithm.
|
inline |
Allocates nbytes bytes.
This function is only used in single-segment management. Never throws
Referenced by boost::interprocess::segment_manager_base< MemoryAlgorithm >::prot_anonymous_construct().
|
inline |
Allocates nbytes bytes.
Throws boost::interprocess::bad_alloc on failure
|
inline |
Allocates nbytes bytes.
This function is only used in single-segment management. Never throws
|
inline |
Allocates nbytes bytes.
This function is only used in single-segment management. Throws bad_alloc when fails
|
inline |
Allocates n_elements of elem_bytes bytes.
Throws bad_alloc on failure. chain.size() is not increased on failure.
|
inline |
Allocates n_elements, each one of element_lengths[i]*sizeof_element bytes.
Throws bad_alloc on failure. chain.size() is not increased on failure.
|
inline |
Allocates n_elements of elem_bytes bytes.
Non-throwing version. chain.size() is not increased on failure.
|
inline |
Allocates n_elements, each one of element_lengths[i]*sizeof_element bytes.
Non-throwing version. chain.size() is not increased on failure.
|
inline |
|
inline |
Returns the result of "check_sanity()" function of the used memory algorithm.
|
inline |
Deallocates the bytes allocated with allocate/allocate_many() pointed by addr.
Referenced by boost::interprocess::segment_manager_base< MemoryAlgorithm >::prot_anonymous_destroy().
|
inline |
Deallocates all elements contained in chain.
Never throws.
|
inline |
Returns the number of free bytes of the memory segment.
|
inlinestatic |
Obtains the minimum size needed by the segment manager.
Referenced by boost::interprocess::segment_manager< CharType, MemoryAlgorithm, IndexType >::get_min_size().
|
inline |
Returns the size of the memory segment.
|
inline |
Increases managed memory in extra_size bytes more.
This only works with single-segment management.
|
inlineprotected |
|
inlineprotected |
Calls the destructor and makes an anonymous deallocate.
References BOOST_ASSERT, and boost::interprocess::segment_manager_base< MemoryAlgorithm >::deallocate().
|
inline |
|
inline |
Decreases managed memory to the minimum.
This only works with single-segment management.
|
inline |
Returns the size of the buffer previously allocated pointed by ptr.
References boost::fusion::size().
|
inline |
Writes to zero free memory (memory not yet allocated) of the memory algorithm.
|
static |
This constant indicates the payload size associated with each allocation of the memory algorithm.