Name

cache_aligned_allocator<T> Template Class — Template class for allocating memory in way that avoids false sharing.

Synopsis

#include "tbb/cache_aligned_allocator.h"

template<typename T> class cache_aligned_allocator;

Description

A cache_aligned_allocator allocates memory on cache-line boundaries to avoid false sharing. False sharing is when logically distinct items occupy the same cache line, which can hurt performance if multiple threads attempt to access the different items simultaneously.

A cache_aligned_allocator models the allocator requirements. It can be used to replace an std::allocator.

Members

 namespace tbb { template<typename T> class NFS_Allocator { public: typedef T* pointer; typedef const T* const_pointer; typedef T& reference; typedef const T& const_reference; typedef T value_type; typedef size_t size_type; typedef ptrdiff_t difference_type; template<typename U> struct rebind { typedef cache_aligned_allocator<U> other; }; #if _WIN64 char* _Charalloc( size_type size ); #endif /* _WIN64 */ cache_aligned_allocator() throw(); cache_aligned_allocator( const cache_aligned_allocator& ) throw(); template<typename U> cache_aligned_allocator( const cache_aligned_allocator<U>& ) throw(); ~cache_aligned_allocator(); pointer address(reference x) const; const_pointer address(const_reference x) const; pointer allocate( size_type n, void* hint=0 ); void deallocate( pointer p, size_type ); size_type max_size() const throw(); void construct( pointer p, const T& value ); void destroy( ...

Get Intel Threading Building Blocks now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.