mxnet
Public Types | Public Member Functions | List of all members
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>

Collaboration diagram for dmlc::ThreadlocalAllocator< T >:
Collaboration graph

Public Types

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

Public Member Functions

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

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.

Member Typedef Documentation

template<typename T>
typedef const T* dmlc::ThreadlocalAllocator< T >::const_ptr

const pointer type

template<typename T>
typedef T* dmlc::ThreadlocalAllocator< T >::pointer

pointer type

template<typename T>
typedef T dmlc::ThreadlocalAllocator< T >::value_type

value type

Constructor & Destructor Documentation

template<typename T>
dmlc::ThreadlocalAllocator< T >::ThreadlocalAllocator ( )
inline

default constructor

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

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.
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: