/usr/include/boost/container/detail
NameSizeModeActions
adaptive_node_pool.hpp55690644editdlrm
adaptive_node_pool_impl.hpp540880644editdlrm
addressof.hpp10630644editdlrm
advanced_insert_int.hpp176680644editdlrm
algorithm.hpp38800644editdlrm
allocation_type.hpp20170644editdlrm
allocator_version_traits.hpp56320644editdlrm
alloc_helpers.hpp18670644editdlrm
alloc_lib.h117420644editdlrm
auto_link.hpp16570644editdlrm
block_list.hpp41990644editdlrm
block_slist.hpp45030644editdlrm
compare_functors.hpp39920644editdlrm
config_begin.hpp36370644editdlrm
config_end.hpp4800644editdlrm
construct_in_place.hpp29520644editdlrm
container_or_allocator_rebind.hpp17430644editdlrm
container_rebind.hpp66100644editdlrm
copy_move_algo.hpp385310644editdlrm
destroyers.hpp93380644editdlrm
dispatch_uses_allocator.hpp197330644editdlrm
dlmalloc.hpp34440644editdlrm
flat_tree.hpp616630644editdlrm
function_detector.hpp35580644editdlrm
is_container.hpp22130644editdlrm
is_contiguous_container.hpp17120644editdlrm
is_sorted.hpp14650644editdlrm
iterator.hpp25900644editdlrm
iterators.hpp298820644editdlrm
iterator_to_raw_pointer.hpp9710644editdlrm
math_functions.hpp38720644editdlrm
minimal_char_traits_header.hpp10570644editdlrm
min_max.hpp9970644editdlrm
mpl.hpp38340644editdlrm
multiallocation_chain.hpp103170644editdlrm
mutex.hpp86650644editdlrm
next_capacity.hpp21400644editdlrm
node_alloc_holder.hpp176510644editdlrm
node_pool.hpp48080644editdlrm
node_pool_impl.hpp131710644editdlrm
pair.hpp212810644editdlrm
pair_key_mapped_of_value.hpp14660644editdlrm
placement_new.hpp9140644editdlrm
pool_common.hpp16060644editdlrm
pool_common_alloc.hpp27300644editdlrm
pool_resource.hpp77440644editdlrm
singleton.hpp44650644editdlrm
std_fwd.hpp14500644editdlrm
thread_mutex.hpp44490644editdlrm
transform_iterator.hpp51030644editdlrm
tree.hpp570380644editdlrm
type_traits.hpp27140644editdlrm
value_functors.hpp11180644editdlrm
value_init.hpp11350644editdlrm
variadic_templates_tools.hpp49590644editdlrm
version_type.hpp24160644editdlrm
workaround.hpp45010644editdlrm
Edit: /usr/include/boost/container/detail/pool_resource.hpp (7744B)
////////////////////////////////////////////////////////////////////////////// // // (C) Copyright Ion Gaztanaga 2015-2015. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // See http://www.boost.org/libs/container for documentation. // ////////////////////////////////////////////////////////////////////////////// #ifndef BOOST_CONTAINER_POOL_RESOURCE_HPP #define BOOST_CONTAINER_POOL_RESOURCE_HPP #if defined (_MSC_VER) # pragma once #endif #include #include #include #include #include #include namespace boost { namespace container { namespace pmr { #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) class pool_data_t; static const std::size_t pool_options_minimum_max_blocks_per_chunk = 1u; static const std::size_t pool_options_default_max_blocks_per_chunk = 32u; static const std::size_t pool_options_minimum_largest_required_pool_block = memory_resource::max_align > 2*sizeof(void*) ? memory_resource::max_align : 2*sizeof(void*); static const std::size_t pool_options_default_largest_required_pool_block = pool_options_minimum_largest_required_pool_block > 4096u ? pool_options_minimum_largest_required_pool_block : 4096u; #endif //BOOST_CONTAINER_DOXYGEN_INVOKED class pool_resource { typedef block_list_base<> block_list_base_t; pool_options m_options; memory_resource& m_upstream; block_list_base_t m_oversized_list; pool_data_t *m_pool_data; std::size_t m_pool_count; static void priv_limit_option(std::size_t &val, std::size_t min, std::size_t max); static std::size_t priv_pool_index(std::size_t block_size); static std::size_t priv_pool_block(std::size_t index); void priv_fix_options(); void priv_init_pools(); void priv_constructor_body(); public: //! Requires: `upstream` is the address of a valid memory resource. //! //! Effects: 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. //! //! Throws: Nothing unless upstream->allocate() throws. It is unspecified if //! or under what conditions this constructor calls upstream->allocate(). pool_resource(const pool_options& opts, memory_resource* upstream) BOOST_NOEXCEPT; //! Effects: Same as //! `pool_resource(pool_options(), get_default_resource())`. pool_resource() BOOST_NOEXCEPT; //! Effects: Same as //! `pool_resource(pool_options(), upstream)`. explicit pool_resource(memory_resource* upstream) BOOST_NOEXCEPT; //! Effects: Same as //! `pool_resource(opts, get_default_resource())`. explicit pool_resource(const pool_options& opts) BOOST_NOEXCEPT; #if !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) pool_resource(const pool_resource&) = delete; pool_resource operator=(const pool_resource&) = delete; #else private: pool_resource (const pool_resource&); pool_resource operator=(const pool_resource&); public: #endif //! Effects: Calls //! `this->release()`. virtual ~pool_resource(); //! Effects: 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(); //! Returns: The value of the upstream argument provided to the //! constructor of this object. memory_resource* upstream_resource() const; //! Returns: 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 //! Returns: 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`. //! //! Effects: 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()`. //! //! Throws: Nothing unless `upstream_resource()->allocate()` throws. virtual void* do_allocate(std::size_t bytes, std::size_t alignment); //! Effects: 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()`. //! //! Throws: Nothing. virtual void do_deallocate(void* p, std::size_t bytes, std::size_t alignment); //! Returns: //! `this == dynamic_cast(&other)`. virtual bool do_is_equal(const memory_resource& other) const BOOST_NOEXCEPT; //Non-standard observers public: //! Returns: The number of pools that will be used in the pool resource. //! //! Note: Non-standard extension. std::size_t pool_count() const; //! Returns: The index of the pool that will be used to serve the allocation of `bytes`. //! from the pool specified by `pool_index`. Returns `pool_count()` if `bytes` is bigger //! than `options().largest_required_pool_block` (no pool will be used to serve this). //! //! Note: Non-standard extension. std::size_t pool_index(std::size_t bytes) const; //! Requires: `pool_idx < pool_index()` //! //! Returns: The number blocks that will be allocated in the next chunk //! from the pool specified by `pool_idx`. //! //! Note: Non-standard extension. std::size_t pool_next_blocks_per_chunk(std::size_t pool_idx) const; //! Requires: `pool_idx < pool_index()` //! //! Returns: The number of bytes of the block that the specified `pool_idx` pool manages. //! //! Note: Non-standard extension. std::size_t pool_block(std::size_t pool_idx) const; //! Requires: `pool_idx < pool_index()` //! //! Returns: The number of blocks that the specified `pool_idx` pool has cached //! and will be served without calling the upstream_allocator. //! //! Note: Non-standard extension. std::size_t pool_cached_blocks(std::size_t pool_idx) const; }; } //namespace pmr { } //namespace container { } //namespace boost { #include #endif //BOOST_CONTAINER_POOL_RESOURCE_HPP