view release on metacpan or search on metacpan
include/boost/container/pmr/memory_resource.hpp
include/boost/container/pmr/monotonic_buffer_resource.hpp
include/boost/container/pmr/polymorphic_allocator.hpp
include/boost/container/pmr/pool_options.hpp
include/boost/container/pmr/resource_adaptor.hpp
include/boost/container/pmr/set.hpp
include/boost/container/pmr/slist.hpp
include/boost/container/pmr/small_vector.hpp
include/boost/container/pmr/stable_vector.hpp
include/boost/container/pmr/string.hpp
include/boost/container/pmr/synchronized_pool_resource.hpp
include/boost/container/pmr/unsynchronized_pool_resource.hpp
include/boost/container/pmr/vector.hpp
include/boost/container/scoped_allocator.hpp
include/boost/container/scoped_allocator_fwd.hpp
include/boost/container/set.hpp
include/boost/container/slist.hpp
include/boost/container/small_vector.hpp
include/boost/container/stable_vector.hpp
include/boost/container/static_vector.hpp
include/boost/container/string.hpp
include/boost/container/throw_exception.hpp
include/boost/container/container_fwd.hpp view on Meta::CPAN
//! Forward declares the following allocators:
//! - boost::container::allocator
//! - boost::container::node_allocator
//! - boost::container::adaptive_pool
//!
//! Forward declares the following polymorphic resource classes:
//! - boost::container::pmr::memory_resource
//! - boost::container::pmr::polymorphic_allocator
//! - boost::container::pmr::monotonic_buffer_resource
//! - boost::container::pmr::pool_options
//! - boost::container::pmr::unsynchronized_pool_resource
//! - boost::container::pmr::synchronized_pool_resource
//!
//! And finally it defines the following types
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
//Std forward declarations
#ifndef BOOST_CONTAINER_DETAIL_STD_FWD_HPP
#include <boost/container/detail/std_fwd.hpp>
#endif
include/boost/container/container_fwd.hpp view on Meta::CPAN
template<class T>
class polymorphic_allocator;
class monotonic_buffer_resource;
struct pool_options;
template <class Allocator>
class resource_adaptor_imp;
class unsynchronized_pool_resource;
class synchronized_pool_resource;
} //namespace pmr {
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
//! Type used to tag that the input range is
//! guaranteed to be ordered
struct ordered_range_t
{};
include/boost/container/detail/mutex.hpp view on Meta::CPAN
#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
//#define BOOST_CONTAINER_NO_MT
//#define BOOST_CONTAINER_NO_SPINLOCKS
#include <boost/container/detail/config_begin.hpp>
#include <boost/container/detail/workaround.hpp>
// Extremely Light-Weight wrapper classes for OS thread synchronization
#define BOOST_MUTEX_HELPER_NONE 0
#define BOOST_MUTEX_HELPER_WIN32 1
#define BOOST_MUTEX_HELPER_PTHREAD 2
#define BOOST_MUTEX_HELPER_SPINLOCKS 3
#if !defined(BOOST_HAS_THREADS) && !defined(BOOST_NO_MT)
# define BOOST_NO_MT
#endif
include/boost/container/detail/pool_resource.hpp view on Meta::CPAN
//! <b>Returns</b>: The value of the upstream argument provided to the
//! constructor of this object.
memory_resource* upstream_resource() const;
//! <b>Returns</b>: The options that control the pooling behavior of this resource.
//! The values in the returned struct may differ from those supplied to the pool
//! resource constructor in that values of zero will be replaced with
//! implementation-defined defaults and sizes may be rounded to unspecified granularity.
pool_options options() const;
public: //public so that [un]synchronized_pool_resource can use them
//! <b>Returns</b>: A pointer to allocated storage with a size of at least `bytes`.
//! The size and alignment of the allocated memory shall meet the requirements for
//! a class derived from `memory_resource`.
//!
//! <b>Effects</b>: If the pool selected for a block of size bytes is unable to
//! satisfy the memory request from its own internal data structures, it will call
//! `upstream_resource()->allocate()` to obtain more memory. If `bytes` is larger
//! than that which the largest pool can handle, then memory will be allocated
//! using `upstream_resource()->allocate()`.
include/boost/container/pmr/global_resource.hpp view on Meta::CPAN
BOOST_CONTAINER_DECL memory_resource* null_memory_resource() BOOST_NOEXCEPT;
//! <b>Effects</b>: If r is non-null, sets the value of the default memory resource
//! pointer to r, otherwise sets the default memory resource pointer to new_delete_resource().
//!
//! <b>Postconditions</b>: get_default_resource() == r.
//!
//! <b>Returns</b>: The previous value of the default memory resource pointer.
//!
//! <b>Remarks</b>: Calling the set_default_resource and get_default_resource functions shall
//! not incur a data race. A call to the set_default_resource function shall synchronize
//! with subsequent calls to the set_default_resource and get_default_resource functions.
BOOST_CONTAINER_DECL memory_resource* set_default_resource(memory_resource* r) BOOST_NOEXCEPT;
//! <b>Returns</b>: The current value of the default
//! memory resource pointer.
BOOST_CONTAINER_DECL memory_resource* get_default_resource() BOOST_NOEXCEPT;
} //namespace pmr {
} //namespace container {
} //namespace boost {
include/boost/container/pmr/monotonic_buffer_resource.hpp view on Meta::CPAN
//! increases monotonically until the resource is destroyed.
//!
//! - The program can supply an initial buffer, which the allocator uses to satisfy
//! memory requests.
//!
//! - When the initial buffer (if any) is exhausted, it obtains additional buffers
//! from an upstream memory resource supplied at construction. Each additional
//! buffer is larger than the previous one, following a geometric progression.
//!
//! - It is intended for access from one thread of control at a time. Specifically,
//! calls to allocate and deallocate do not synchronize with one another.
//!
//! - It owns the allocated memory and frees it on destruction, even if deallocate has
//! not been called for some of the allocated blocks.
class BOOST_CONTAINER_DECL monotonic_buffer_resource
: public memory_resource
{
block_slist m_memory_blocks;
void * m_current_buffer;
std::size_t m_current_buffer_size;
std::size_t m_next_buffer_size;
include/boost/container/pmr/synchronized_pool_resource.hpp view on Meta::CPAN
#include <boost/container/pmr/memory_resource.hpp>
#include <boost/container/detail/pool_resource.hpp>
#include <boost/container/detail/thread_mutex.hpp>
#include <cstddef>
namespace boost {
namespace container {
namespace pmr {
//! A synchronized_pool_resource is a general-purpose memory resources having
//! the following qualities:
//!
//! - Each resource owns the allocated memory, and frees it on destruction,
//! even if deallocate has not been called for some of the allocated blocks.
//!
//! - A pool resource consists of a collection of pools, serving
//! requests for different block sizes. Each individual pool manages a
//! collection of chunks that are in turn divided into blocks of uniform size,
//! returned via calls to do_allocate. Each call to do_allocate(size, alignment)
//! is dispatched to the pool serving the smallest blocks accommodating at
include/boost/container/pmr/synchronized_pool_resource.hpp view on Meta::CPAN
//! geometrically. [ Note: By allocating memory in chunks, the pooling strategy
//! increases the chance that consecutive allocations will be close together
//! in memory. - end note ]
//!
//! - Allocation requests that exceed the largest block size of any pool are
//! fulfilled directly from the upstream allocator.
//!
//! - A pool_options struct may be passed to the pool resource constructors to
//! tune the largest block size and the maximum chunk size.
//!
//! A synchronized_pool_resource may be accessed from multiple threads without
//! external synchronization and may have thread-specific pools to reduce
//! synchronization costs.
class BOOST_CONTAINER_DECL synchronized_pool_resource
: public memory_resource
{
dtl::thread_mutex m_mut;
pool_resource m_pool_resource;
public:
//! @copydoc ::boost::container::pmr::unsynchronized_pool_resource::unsynchronized_pool_resource(const pool_options&,memory_resource*)
synchronized_pool_resource(const pool_options& opts, memory_resource* upstream) BOOST_NOEXCEPT;
//! @copydoc ::boost::container::pmr::unsynchronized_pool_resource::unsynchronized_pool_resource()
synchronized_pool_resource() BOOST_NOEXCEPT;
//! @copydoc ::boost::container::pmr::unsynchronized_pool_resource::unsynchronized_pool_resource(memory_resource*)
explicit synchronized_pool_resource(memory_resource* upstream) BOOST_NOEXCEPT;
//! @copydoc ::boost::container::pmr::unsynchronized_pool_resource::unsynchronized_pool_resource(const pool_options&)
explicit synchronized_pool_resource(const pool_options& opts) BOOST_NOEXCEPT;
#if !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
synchronized_pool_resource(const synchronized_pool_resource&) = delete;
synchronized_pool_resource operator=(const synchronized_pool_resource&) = delete;
#else
private:
synchronized_pool_resource (const synchronized_pool_resource&);
synchronized_pool_resource operator=(const synchronized_pool_resource&);
public:
#endif
//! @copydoc ::boost::container::pmr::unsynchronized_pool_resource::~unsynchronized_pool_resource()
virtual ~synchronized_pool_resource();
//! @copydoc ::boost::container::pmr::unsynchronized_pool_resource::release()
void release();
//! @copydoc ::boost::container::pmr::unsynchronized_pool_resource::upstream_resource()const
memory_resource* upstream_resource() const;
//! @copydoc ::boost::container::pmr::unsynchronized_pool_resource::options()const
pool_options options() const;
protected:
//! @copydoc ::boost::container::pmr::unsynchronized_pool_resource::do_allocate()
virtual void* do_allocate(std::size_t bytes, std::size_t alignment);
//! @copydoc ::boost::container::pmr::unsynchronized_pool_resource::do_deallocate(void*,std::size_t,std::size_t)
virtual void do_deallocate(void* p, std::size_t bytes, std::size_t alignment);
//! @copydoc ::boost::container::pmr::unsynchronized_pool_resource::do_is_equal(const memory_resource&)const
virtual bool do_is_equal(const memory_resource& other) const BOOST_NOEXCEPT;
//Non-standard observers
public:
//! @copydoc ::boost::container::pmr::unsynchronized_pool_resource::pool_count()
std::size_t pool_count() const;
//! @copydoc ::boost::container::pmr::unsynchronized_pool_resource::pool_index(std::size_t)const
std::size_t pool_index(std::size_t bytes) const;
//! @copydoc ::boost::container::pmr::unsynchronized_pool_resource::pool_next_blocks_per_chunk(std::size_t)const
std::size_t pool_next_blocks_per_chunk(std::size_t pool_idx) const;
//! @copydoc ::boost::container::pmr::unsynchronized_pool_resource::pool_block(std::size_t)const
std::size_t pool_block(std::size_t pool_idx) const;
//! @copydoc ::boost::container::pmr::unsynchronized_pool_resource::pool_cached_blocks(std::size_t)const
std::size_t pool_cached_blocks(std::size_t pool_idx) const;
};
} //namespace pmr {
} //namespace container {
} //namespace boost {
#include <boost/container/detail/config_end.hpp>
#endif //BOOST_CONTAINER_PMR_SYNCHRONIZED_POOL_RESOURCE_HPP
include/boost/container/pmr/unsynchronized_pool_resource.hpp view on Meta::CPAN
#include <boost/container/detail/auto_link.hpp>
#include <boost/container/pmr/memory_resource.hpp>
#include <boost/container/detail/pool_resource.hpp>
#include <cstddef>
namespace boost {
namespace container {
namespace pmr {
//! A unsynchronized_pool_resource is a general-purpose memory resources having
//! the following qualities:
//!
//! - Each resource owns the allocated memory, and frees it on destruction,
//! even if deallocate has not been called for some of the allocated blocks.
//!
//! - A pool resource consists of a collection of pools, serving
//! requests for different block sizes. Each individual pool manages a
//! collection of chunks that are in turn divided into blocks of uniform size,
//! returned via calls to do_allocate. Each call to do_allocate(size, alignment)
//! is dispatched to the pool serving the smallest blocks accommodating at
include/boost/container/pmr/unsynchronized_pool_resource.hpp view on Meta::CPAN
//! geometrically. [ Note: By allocating memory in chunks, the pooling strategy
//! increases the chance that consecutive allocations will be close together
//! in memory. - end note ]
//!
//! - Allocation requests that exceed the largest block size of any pool are
//! fulfilled directly from the upstream allocator.
//!
//! - A pool_options struct may be passed to the pool resource constructors to
//! tune the largest block size and the maximum chunk size.
//!
//! An unsynchronized_pool_resource class may not be accessed from multiple threads
//! simultaneously and thus avoids the cost of synchronization entirely in
//! single-threaded applications.
class BOOST_CONTAINER_DECL unsynchronized_pool_resource
: public memory_resource
{
pool_resource m_resource;
public:
//! <b>Requires</b>: `upstream` is the address of a valid memory resource.
//!
//! <b>Effects</b>: Constructs a pool resource object that will obtain memory
//! from upstream whenever the pool resource is unable to satisfy a memory
//! request from its own internal data structures. The resulting object will hold
//! a copy of upstream, but will not own the resource to which upstream points.
//! [ Note: The intention is that calls to upstream->allocate() will be
//! substantially fewer than calls to this->allocate() in most cases. - end note
//! The behavior of the pooling mechanism is tuned according to the value of
//! the opts argument.
//!
//! <b>Throws</b>: Nothing unless upstream->allocate() throws. It is unspecified if
//! or under what conditions this constructor calls upstream->allocate().
unsynchronized_pool_resource(const pool_options& opts, memory_resource* upstream) BOOST_NOEXCEPT;
//! <b>Effects</b>: Same as
//! `unsynchronized_pool_resource(pool_options(), get_default_resource())`.
unsynchronized_pool_resource() BOOST_NOEXCEPT;
//! <b>Effects</b>: Same as
//! `unsynchronized_pool_resource(pool_options(), upstream)`.
explicit unsynchronized_pool_resource(memory_resource* upstream) BOOST_NOEXCEPT;
//! <b>Effects</b>: Same as
//! `unsynchronized_pool_resource(opts, get_default_resource())`.
explicit unsynchronized_pool_resource(const pool_options& opts) BOOST_NOEXCEPT;
#if !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
unsynchronized_pool_resource(const unsynchronized_pool_resource&) = delete;
unsynchronized_pool_resource operator=(const unsynchronized_pool_resource&) = delete;
#else
private:
unsynchronized_pool_resource (const unsynchronized_pool_resource&);
unsynchronized_pool_resource operator=(const unsynchronized_pool_resource&);
public:
#endif
//! <b>Effects</b>: Calls
//! `this->release()`.
virtual ~unsynchronized_pool_resource();
//! <b>Effects</b>: Calls Calls `upstream_resource()->deallocate()` as necessary
//! to release all allocated memory. [ Note: memory is released back to
//! `upstream_resource()` even if deallocate has not been called for some
//! of the allocated blocks. - end note ]
void release();
//! <b>Returns</b>: The value of the upstream argument provided to the
//! constructor of this object.
memory_resource* upstream_resource() const;
include/boost/container/pmr/unsynchronized_pool_resource.hpp view on Meta::CPAN
virtual void* do_allocate(std::size_t bytes, std::size_t alignment);
//! <b>Effects</b>: Return the memory at p to the pool. It is unspecified if or under
//! what circumstances this operation will result in a call to
//! `upstream_resource()->deallocate()`.
//!
//! <b>Throws</b>: Nothing.
virtual void do_deallocate(void* p, std::size_t bytes, std::size_t alignment);
//! <b>Returns</b>:
//! `this == dynamic_cast<const unsynchronized_pool_resource*>(&other)`.
virtual bool do_is_equal(const memory_resource& other) const BOOST_NOEXCEPT;
//Non-standard observers
public:
//! <b>Returns</b>: The number of pools that will be used in the pool resource.
//!
//! <b>Note</b>: Non-standard extension.
std::size_t pool_count() const;
//! <b>Returns</b>: The index of the pool that will be used to serve the allocation of `bytes`.