Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.

Class template basic_managed_heap_memory



// In header: <boost/interprocess/managed_heap_memory.hpp>

template<typename CharType, typename AllocationAlgorithm, 
         template< class IndexConfig > class IndexType> 
class basic_managed_heap_memory {
  // construct/copy/destruct
  basic_managed_heap_memory(basic_managed_heap_memory &&);
  basic_managed_heap_memory& operator=(basic_managed_heap_memory &&);

  // public member functions
  bool grow(std::size_t) ;
  void swap(basic_managed_heap_memory &&) ;


A basic heap memory named object creation class. Initializes the heap memory segment. Inherits all basic functionality from basic_managed_memory_impl<CharType, AllocationAlgorithm, IndexType>

basic_managed_heap_memory public construct/copy/destruct

  1. basic_managed_heap_memory();

    Default constructor. Does nothing. Useful in combination with move semantics

  2. basic_managed_heap_memory(std::size_t size);

    Creates heap memory and initializes the segment manager. This can throw.

  3. basic_managed_heap_memory(basic_managed_heap_memory && moved);
  4. basic_managed_heap_memory& operator=(basic_managed_heap_memory && moved);
  5. ~basic_managed_heap_memory();

    Destructor. Liberates the heap memory holding the managed data. Never throws.

basic_managed_heap_memory public member functions

  1. bool grow(std::size_t extra_bytes) ;

    Tries to resize internal heap memory so that we have room for more objects. WARNING: If memory is reallocated, all the objects will be binary-copied to the new buffer. To be able to use this function, all pointers constructed in this buffer must be offset pointers. Otherwise, the result is undefined. Returns true if the growth has been successful, so you will have some extra bytes to allocate new objects. If returns false, the heap allocation has failed.

  2. void swap(basic_managed_heap_memory && other) ;

    Swaps the ownership of the managed heap memories managed by *this and other. Never throws.