Medial Code Documentation
Loading...
Searching...
No Matches
Public Types | Public Member Functions
dmlc::ThreadlocalAllocator< T > Class Template Reference

A thread local allocator that get memory from a threadlocal memory pool. This is suitable to allocate objects that do not cross thread. More...

#include <memory.h>

Public Types

typedef T * pointer
 pointer type
 
typedef const T * const_ptr
 const pointer type
 
typedef T value_type
 value type
 

Public Member Functions

 ThreadlocalAllocator ()
 default constructor
 
template<typename U >
 ThreadlocalAllocator (const ThreadlocalAllocator< U > &other)
 constructor from another allocator
 
T * allocate (size_t n)
 allocate memory
 
void deallocate (T *p, size_t n)
 deallocate memory
 

Detailed Description

template<typename T>
class dmlc::ThreadlocalAllocator< T >

A thread local allocator that get memory from a threadlocal memory pool. This is suitable to allocate objects that do not cross thread.

Template Parameters
Tthe type of the data to be allocated.

Constructor & Destructor Documentation

◆ ThreadlocalAllocator()

template<typename T >
template<typename U >
dmlc::ThreadlocalAllocator< T >::ThreadlocalAllocator ( const ThreadlocalAllocator< U > &  other)
inline

constructor from another allocator

Parameters
otheranother allocator
Template Parameters
Uanother type

Member Function Documentation

◆ allocate()

template<typename T >
T * dmlc::ThreadlocalAllocator< T >::allocate ( size_t  n)
inline

allocate memory

Parameters
nnumber of blocks
Returns
an uninitialized memory of type T.

◆ deallocate()

template<typename T >
void dmlc::ThreadlocalAllocator< T >::deallocate ( T *  p,
size_t  n 
)
inline

deallocate memory

Parameters
pa memory to be returned.
nnumber of blocks

The documentation for this class was generated from the following file: