TBCI Numerical high perf. C++ Library  2.8.0
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
tbci_memalloc_cache< T > Struct Template Reference

For specializations of the memory allocator: More...

#include <malloc_cache.h>

Public Member Functions

int find_by_sz (const unsigned ln) const
 Find free slot with right len, starting point for search is free_idx. More...
 
void enter (const T *const ptr, const unsigned ln)
 Enter into list of FREE slots. More...
 
void free_and_enter (const T *const ptr, const unsigned ln)
 
void rmv (const unsigned idx)
 Remove from list of FREE slots. More...
 
const Tfind_and_rmv (const unsigned sz)
 
Talloc (const unsigned long)
 
void dealloc (const T *const, const unsigned long)
 
void deinit (const int thr)
 
void init (const int thr)
 
void smp_init ()
 
void smp_deinit ()
 
 sizeof (tbci_memalloc_cache_tls< T >)*(num_threads+1))
 
 init (0)
 
 if (nthr)
 
 thread_reg_callback ((cbackfn *)&_init,(cbackfn *)&_deinit,(void *) this)
 
 ~tbci_memalloc_cache ()
 

Static Public Member Functions

static void _init (tbci_memalloc_cache< T > *th, const int thr)
 
static void _deinit (tbci_memalloc_cache< T > *th, const int thr)
 

Public Attributes

tbci_memalloc_cache_tls< T > * malloc_tls
 
int nthr
 
 __pad0__: nthr(num_threads) { malloc_tls = (tbci_memalloc_cache_tls<T>*) memalign(128
 

Detailed Description

template<typename T>
struct tbci_memalloc_cache< T >

For specializations of the memory allocator:

Definition at line 279 of file malloc_cache.h.

Constructor & Destructor Documentation

template<typename T>
tbci_memalloc_cache< T >::~tbci_memalloc_cache ( )
inline

Member Function Documentation

template<typename T>
static void tbci_memalloc_cache< T >::_deinit ( tbci_memalloc_cache< T > *  th,
const int  thr 
)
inlinestatic
template<typename T>
static void tbci_memalloc_cache< T >::_init ( tbci_memalloc_cache< T > *  th,
const int  thr 
)
inlinestatic
template<typename T >
T * tbci_memalloc_cache< T >::alloc ( const unsigned long  sz)
inline

We MAY be thread safe on x86 and x86-64, but not anywhere else

Definition at line 467 of file malloc_cache.h.

References _MC_NEW, BCHK, DEBUG_PRINTF3, ismainthread, T, TBCI_MALLOC_LIMIT, thrno, and UNLIKELY.

template<typename T >
void tbci_memalloc_cache< T >::dealloc ( const T * const  ptr,
const unsigned long  sz 
)
inline

Definition at line 508 of file malloc_cache.h.

References _MC_DELETE, BCHK, CSTD__, ismainthread, T, TBCI_MALLOC_LIMIT, and UNLIKELY.

template<typename T >
void tbci_memalloc_cache< T >::deinit ( const int  thr)
inline
template<typename T >
void tbci_memalloc_cache< T >::enter ( const T *const  ptr,
const unsigned  ln 
)
inline
template<typename T >
const T * tbci_memalloc_cache< T >::find_and_rmv ( const unsigned  sz)
inline

Definition at line 452 of file malloc_cache.h.

References LIKELY, SMP_LOCK, SMP_UNLOCK, T, and thrno.

template<typename T >
int tbci_memalloc_cache< T >::find_by_sz ( const unsigned  ln) const
inline
template<typename T >
void tbci_memalloc_cache< T >::free_and_enter ( const T *const  ptr,
const unsigned  ln 
)
inline
template<typename T>
tbci_memalloc_cache< T >::if ( nthr  )
inline

Definition at line 378 of file malloc_cache.h.

References tbci_memalloc_cache< T >::smp_init().

template<typename T>
void tbci_memalloc_cache< T >::init ( const int  thr)
inline
template<typename T>
tbci_memalloc_cache< T >::init ( )
template<typename T >
void tbci_memalloc_cache< T >::rmv ( const unsigned  idx)
inline

Remove from list of FREE slots.

Definition at line 444 of file malloc_cache.h.

References tbci_memalloc_cache_tls< T >::free_idx, tbci_memalloc_cache_tls< T >::free_sz, and thrno.

template<typename T>
tbci_memalloc_cache< T >::sizeof ( tbci_memalloc_cache_tls< T )
template<typename T>
void tbci_memalloc_cache< T >::smp_deinit ( )
inline
template<typename T>
void tbci_memalloc_cache< T >::smp_init ( )
inline
template<typename T>
tbci_memalloc_cache< T >::thread_reg_callback ( (cbackfn *)&  _init,
(cbackfn *)&  _deinit,
(void *)  this 
)

Member Data Documentation

template<typename T>
tbci_memalloc_cache< T >::__pad0__

Definition at line 375 of file malloc_cache.h.

template<typename T>
tbci_memalloc_cache_tls<T>* tbci_memalloc_cache< T >::malloc_tls
template<typename T>
int tbci_memalloc_cache< T >::nthr

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