Home ⌂Doc Index ◂Up ▴
Intel(R) Threading Building Blocks Doxygen Documentation  version 4.2.3
Memory Allocation

Classes

class  tbb::cache_aligned_allocator< T >
 Meets "allocator" requirements of ISO C++ Standard, Section 20.1.5. More...
 
class  tbb::cache_aligned_allocator< void >
 Analogous to std::allocator<void>, as defined in ISO C++ Standard, Section 20.4.1. More...
 
class  tbb::interface6::memory_pool_allocator< T, P >
 Meets "allocator" requirements of ISO C++ Standard, Section 20.1.5. More...
 
class  tbb::interface6::memory_pool_allocator< void, P >
 Analogous to std::allocator<void>, as defined in ISO C++ Standard, Section 20.4.1. More...
 
class  tbb::tbb_allocator< T >
 Meets "allocator" requirements of ISO C++ Standard, Section 20.1.5. More...
 
class  tbb::tbb_allocator< void >
 Analogous to std::allocator<void>, as defined in ISO C++ Standard, Section 20.4.1. More...
 
class  tbb::zero_allocator< T, Allocator >
 Meets "allocator" requirements of ISO C++ Standard, Section 20.1.5. More...
 
class  tbb::zero_allocator< void, Allocator >
 Analogous to std::allocator<void>, as defined in ISO C++ Standard, Section 20.4.1. More...
 

Functions

template<typename T , size_t N = 1>
class tbb::__TBB_DEPRECATED_IN_VERBOSE_MODE_MSG ("tbb::aligned_space is deprecated, use std::aligned_storage") aligned_space
 Block of space aligned sufficiently to construct an array T with N elements. More...
 
size_t __TBB_EXPORTED_FUNC tbb::internal::NFS_GetLineSize ()
 Cache/sector line size. More...
 
void *__TBB_EXPORTED_FUNC tbb::internal::NFS_Allocate (size_t n_element, size_t element_size, void *hint)
 Allocate memory on cache/sector line boundary. More...
 
void __TBB_EXPORTED_FUNC tbb::internal::NFS_Free (void *)
 Free memory allocated by NFS_Allocate. More...
 
void *__TBB_EXPORTED_FUNC scalable_malloc (size_t size)
 
void __TBB_EXPORTED_FUNC scalable_free (void *ptr)
 
void *__TBB_EXPORTED_FUNC scalable_realloc (void *ptr, size_t size)
 
void *__TBB_EXPORTED_FUNC scalable_calloc (size_t nobj, size_t size)
 
int __TBB_EXPORTED_FUNC scalable_posix_memalign (void **memptr, size_t alignment, size_t size)
 
void *__TBB_EXPORTED_FUNC scalable_aligned_malloc (size_t size, size_t alignment)
 
void *__TBB_EXPORTED_FUNC scalable_aligned_realloc (void *ptr, size_t size, size_t alignment)
 
void __TBB_EXPORTED_FUNC scalable_aligned_free (void *ptr)
 
size_t __TBB_EXPORTED_FUNC scalable_msize (void *ptr)
 
int __TBB_EXPORTED_FUNC scalable_allocation_mode (int param, intptr_t value)
 
int __TBB_EXPORTED_FUNC scalable_allocation_command (int cmd, void *param)
 

Variables

const size_t tbb::internal::NFS_MaxLineSize = 128
 Compile-time constant that is upper bound on cache line/sector size. More...
 

Detailed Description

Function Documentation

◆ __TBB_DEPRECATED_IN_VERBOSE_MODE_MSG()

template<typename T , size_t N = 1>
class tbb::__TBB_DEPRECATED_IN_VERBOSE_MODE_MSG ( "tbb::aligned_space is  deprecated,
use std::aligned_storage"   
)

Block of space aligned sufficiently to construct an array T with N elements.

The elements are not constructed or destroyed by this class.

Pointer to beginning of array

Pointer to one past last element in array.

Definition at line 43 of file aligned_space.h.

43  {
44 private:
45  typedef __TBB_TypeWithAlignmentAtLeastAsStrict(T) element_type;
46  element_type array[(sizeof(T)*N+sizeof(element_type)-1)/sizeof(element_type)];
47 public:
49  T* begin() const {return internal::punned_cast<T*>(this);}
50 
52  T* end() const {return begin()+N;}
53 };
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 end
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 begin
#define __TBB_TypeWithAlignmentAtLeastAsStrict(T)
Definition: tbb_machine.h:816

References __TBB_TypeWithAlignmentAtLeastAsStrict, begin, and end.

◆ NFS_Allocate()

void * tbb::internal::NFS_Allocate ( size_t  n_element,
size_t  element_size,
void hint 
)

Allocate memory on cache/sector line boundary.

Definition at line 176 of file cache_aligned_allocator.cpp.

176  {
177  //TODO: make this functionality available via an adaptor over generic STL like allocator
178  const size_t nfs_cache_line_size = NFS_LineSize;
179  __TBB_ASSERT( nfs_cache_line_size <= NFS_MaxLineSize, "illegal value for NFS_LineSize" );
180  __TBB_ASSERT( is_power_of_two(nfs_cache_line_size), "must be power of two" );
181  size_t bytes = n*element_size;
182 
183  if (bytes<n || bytes+nfs_cache_line_size<bytes) {
184  // Overflow
186  }
187  // scalable_aligned_malloc considers zero size request an error, and returns NULL
188  if (bytes==0) bytes = 1;
189 
190  void* result = (*padded_allocate_handler)( bytes, nfs_cache_line_size );
191  if (!result)
193 
194  __TBB_ASSERT( is_aligned(result, nfs_cache_line_size), "The address returned isn't aligned to cache line size" );
195  return result;
196 }
bool is_aligned(T *pointer, uintptr_t alignment)
A function to check if passed in pointer is aligned on a specific border.
Definition: tbb_stddef.h:370
const size_t NFS_MaxLineSize
Compile-time constant that is upper bound on cache line/sector size.
Definition: tbb_stddef.h:216
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:165
bool is_power_of_two(integer_type arg)
A function to check if passed integer is a power of 2.
Definition: tbb_stddef.h:376
void throw_exception(exception_id eid)
Versionless convenience wrapper for throw_exception_v4()

References __TBB_ASSERT, tbb::internal::eid_bad_alloc, tbb::internal::is_aligned(), tbb::internal::is_power_of_two(), tbb::internal::NFS_LineSize, tbb::internal::NFS_MaxLineSize, and tbb::internal::throw_exception().

Referenced by tbb::cache_aligned_allocator< T >::allocate(), tbb::internal::arena::allocate_arena(), tbb::internal::custom_scheduler< SchedulerTraits >::allocate_scheduler(), tbb::internal::generic_scheduler::allocate_task(), tbb::internal::arena_slot::allocate_task_pool(), tbb::internal::arena::arena(), tbb::internal::generic_scheduler::create_master(), tbb::internal::concurrent_vector_base_v3::helper::extend_segment_table(), tbb::internal::cpu_ctl_env::get_env(), tbb::internal::market::global_market(), tbb::internal::cpu_ctl_env::operator=(), tbb::internal::fast_reverse_vector< T, max_segments >::push_back(), and tbb::internal::affinity_partitioner_base_v3::resize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ NFS_Free()

◆ NFS_GetLineSize()

size_t tbb::internal::NFS_GetLineSize ( )

Cache/sector line size.

Definition at line 167 of file cache_aligned_allocator.cpp.

167  {
168  return NFS_LineSize;
169 }

References tbb::internal::NFS_LineSize.

Referenced by tbb::internal::arena::allocate_arena(), tbb::internal::arena::arena(), tbb::strict_ppl::internal::concurrent_queue_base_v3< Value >::concurrent_queue_base_v3(), and tbb::internal::concurrent_queue_base_v3::concurrent_queue_base_v3().

Here is the caller graph for this function:

◆ scalable_aligned_free()

void __TBB_EXPORTED_FUNC scalable_aligned_free ( void ptr)

The "_aligned_free" analogue.

◆ scalable_aligned_malloc()

void* __TBB_EXPORTED_FUNC scalable_aligned_malloc ( size_t  size,
size_t  alignment 
)

The "_aligned_malloc" analogue.

◆ scalable_aligned_realloc()

void* __TBB_EXPORTED_FUNC scalable_aligned_realloc ( void ptr,
size_t  size,
size_t  alignment 
)

The "_aligned_realloc" analogue.

◆ scalable_allocation_command()

int __TBB_EXPORTED_FUNC scalable_allocation_command ( int  cmd,
void param 
)

Call TBB allocator-specific commands.

◆ scalable_allocation_mode()

int __TBB_EXPORTED_FUNC scalable_allocation_mode ( int  param,
intptr_t  value 
)

Set TBB allocator-specific allocation modes.

◆ scalable_calloc()

void* __TBB_EXPORTED_FUNC scalable_calloc ( size_t  nobj,
size_t  size 
)

The "calloc" analogue complementing scalable_malloc.

◆ scalable_free()

void __TBB_EXPORTED_FUNC scalable_free ( void ptr)

The "free" analogue to discard a previously allocated piece of memory.

◆ scalable_malloc()

void* __TBB_EXPORTED_FUNC scalable_malloc ( size_t  size)

The "malloc" analogue to allocate block of memory of size bytes.

◆ scalable_msize()

size_t __TBB_EXPORTED_FUNC scalable_msize ( void ptr)

The analogue of msize/malloc_size/malloc_usable_size. Returns the usable size of a memory block previously allocated by scalable*, or 0 (zero) if ptr does not point to such a block.

◆ scalable_posix_memalign()

int __TBB_EXPORTED_FUNC scalable_posix_memalign ( void **  memptr,
size_t  alignment,
size_t  size 
)

The "posix_memalign" analogue.

◆ scalable_realloc()

void* __TBB_EXPORTED_FUNC scalable_realloc ( void ptr,
size_t  size 
)

The "realloc" analogue complementing scalable_malloc.

Variable Documentation

◆ NFS_MaxLineSize

const size_t tbb::internal::NFS_MaxLineSize = 128

Compile-time constant that is upper bound on cache line/sector size.

It should be used only in situations where having a compile-time upper bound is more useful than a run-time exact answer.

Definition at line 216 of file tbb_stddef.h.

Referenced by tbb::internal::arena::allocate_arena(), tbb::internal::arena_slot::allocate_task_pool(), tbb::internal::mail_outbox::construct(), tbb::cache_aligned_allocator< T >::max_size(), and tbb::internal::NFS_Allocate().


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.