Intel(R) Threading Building Blocks Doxygen Documentation
version 4.2.3
|
Go to the documentation of this file.
17 #ifndef __TBB_memory_pool_H
18 #define __TBB_memory_pool_H
20 #if !TBB_PREVIEW_MEMORY_POOL
21 #error Set TBB_PREVIEW_MEMORY_POOL to include memory_pool.h
30 #if __TBB_ALLOCATOR_CONSTRUCT_VARIADIC
35 #define __TBBMALLOC_ASSERT ASSERT
37 #define __TBBMALLOC_ASSERT(a,b) ((void)0)
41 namespace interface6 {
75 #if _MSC_VER && !defined(__INTEL_COMPILER)
77 #pragma warning (push)
78 #pragma warning (disable: 4100)
83 template<
typename T,
typename P =
internal::pool_base>
88 template<
typename U,
typename R>
90 template<
typename V,
typename U,
typename R>
92 template<
typename V,
typename U,
typename R>
128 return (
max > 0 ?
max : 1);
131 #if __TBB_ALLOCATOR_CONSTRUCT_VARIADIC
132 template<
typename U,
typename... Args>
134 { ::new((
void *)
p) U(std::forward<Args>(args)...); }
135 #else // __TBB_ALLOCATOR_CONSTRUCT_VARIADIC
136 #if __TBB_CPP11_RVALUE_REF_PRESENT
140 #endif // __TBB_ALLOCATOR_CONSTRUCT_VARIADIC
147 #if _MSC_VER && !defined(__INTEL_COMPILER)
148 #pragma warning (pop)
149 #endif // warning 4100 is back
160 template<
typename U>
struct rebind {
171 template<
typename U,
typename R>
173 template<
typename V,
typename U,
typename R>
175 template<
typename V,
typename U,
typename R>
179 template<
typename T,
typename U,
typename P>
182 template<
typename T,
typename U,
typename P>
187 template <
typename Alloc>
216 template <
typename Alloc>
219 sizeof(
typename Alloc::value_type));
220 rml::MemPoolError res = rml::pool_create_v1(intptr_t(
this), &args, &
my_pool);
221 if (res!=rml::POOL_OK)
224 template <
typename Alloc>
227 const size_t unit_size =
sizeof(
typename Alloc::value_type);
230 __TBB_TRY { ptr =
self.my_alloc.allocate( bytes/unit_size ); }
234 #if __TBB_MSVC_UNREACHABLE_CODE_IGNORED
237 #pragma warning (push)
238 #pragma warning (disable: 4702)
240 template <
typename Alloc>
243 const size_t unit_size =
sizeof(
typename Alloc::value_type);
245 self.my_alloc.deallocate(
static_cast<typename Alloc::value_type*
>(raw_ptr), raw_bytes/unit_size );
248 #if __TBB_MSVC_UNREACHABLE_CODE_IGNORED
249 #pragma warning (pop)
256 rml::MemPoolError res = rml::pool_create_v1(intptr_t(
this), &args, &
my_pool);
257 if (res!=rml::POOL_OK)
263 bytes =
self.my_size;
265 return self.my_buffer;
274 #undef __TBBMALLOC_ASSERT
275 #endif// __TBB_memory_pool_H
rml::MemoryPool * my_pool
friend bool operator!=(const memory_pool_allocator< V, R > &a, const memory_pool_allocator< U, R > &b)
static int deallocate_request(intptr_t pool_id, void *, size_t raw_bytes)
~memory_pool()
destroy pool
bool operator!=(const memory_pool_allocator< T, P > &a, const memory_pool_allocator< U, P > &b)
Base of thread-safe pool allocator for variable-size requests.
void throw_exception(exception_id eid)
Versionless convenience wrapper for throw_exception_v4()
const_pointer address(const_reference x) const
memory_pool_allocator< U, P > other
static void * allocate_request(intptr_t pool_id, size_t &bytes)
const value_type * const_pointer
friend bool operator==(const memory_pool_allocator< V, R > &a, const memory_pool_allocator< U, R > &b)
#define __TBBMALLOC_ASSERT(a, b)
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t size
memory_pool_allocator(const memory_pool_allocator< U, P > &src)
memory_pool(const Alloc &src=Alloc())
construct pool with underlying allocator
tbb::internal::allocator_type< T >::value_type value_type
~fixed_pool()
destroy pool
friend bool operator==(const memory_pool_allocator< V, R > &a, const memory_pool_allocator< U, R > &b)
void * realloc(void *ptr, size_t size)
The "realloc" analogue complementing pool_malloc.
friend bool operator!=(const memory_pool_allocator< V, R > &a, const memory_pool_allocator< U, R > &b)
size_type max_size() const
Largest value for which method allocate might succeed.
static void * allocate_request(intptr_t pool_id, size_t &bytes)
memory_pool_allocator(const memory_pool_allocator &src)
void deallocate(pointer p, size_type)
Free previously allocated block of memory.
pointer allocate(size_type n, const void *=0)
Allocate space for n objects.
bool operator==(const memory_pool_allocator< T, P > &a, const memory_pool_allocator< U, P > &b)
void move(tbb_thread &t1, tbb_thread &t2)
memory_pool_allocator(pool_type &pool)
Meets "allocator" requirements of ISO C++ Standard, Section 20.1.5.
void * malloc(size_t size)
The "malloc" analogue to allocate block of memory of size bytes.
void construct(pointer p, const value_type &value)
memory_pool_allocator(const memory_pool_allocator< U, P > &src)
void construct(pointer p, value_type &&value)
Copy-construct value at location pointed to by p.
memory_pool_allocator< U, P > other
pointer address(reference x) const
memory_pool_allocator(pool_type &pool)
ptrdiff_t difference_type
void destroy(pointer p)
Destroy value at location pointed to by p.
Base class for types that should not be copied or assigned.
T max(const T &val1, const T &val2)
Utility template function returning greater of the two values.
memory_pool_allocator(const memory_pool_allocator &src)
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain ITT_FORMAT p const __itt_domain __itt_string_handle unsigned long long value
void recycle()
Reset pool to reuse its memory (free all objects at once)
Thread-safe growable pool allocator for variable-size requests.
const void * const_pointer
void const char const char int ITT_FORMAT __itt_group_sync p
void free(void *ptr)
The "free" analogue to discard a previously allocated piece of memory.
void destroy()
destroy pool - must be called in a child class
fixed_pool(void *buf, size_t size)
construct pool with underlying allocator
const value_type & const_reference
Copyright © 2005-2020 Intel Corporation. All Rights Reserved.
Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are
registered trademarks or trademarks of Intel Corporation or its
subsidiaries in the United States and other countries.
* Other names and brands may be claimed as the property of others.