#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. | |
| void | enter (const T *const ptr, const unsigned ln) |
| Enter into list of FREE slots. | |
| void | free_and_enter (const T *const ptr, const unsigned ln) |
| void | rmv (const unsigned idx) |
| Remove from list of FREE slots. | |
| const T * | find_and_rmv (const unsigned sz) |
| T * | alloc (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 () |
| tbci_memalloc_cache () | |
| ~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 |
Definition at line 273 of file malloc_cache.h.
| TBCI::tbci_memalloc_cache< T >::tbci_memalloc_cache | ( | ) | [inline] |
Definition at line 362 of file malloc_cache.h.
| TBCI::tbci_memalloc_cache< T >::~tbci_memalloc_cache | ( | ) | [inline] |
Definition at line 381 of file malloc_cache.h.
| int TBCI::tbci_memalloc_cache< T >::find_by_sz | ( | const unsigned | ln | ) | const [inline] |
Find free slot with right len, starting point for search is free_idx.
Definition at line 396 of file malloc_cache.h.
References BCHK, DEBUG_PRINTF1, DEBUG_PRINTF2, TBCI::tbci_memalloc_cache< T >::malloc_tls, TBCI::tbci_memalloc_cache< T >::nthr, small, TBCI_MALLOC_POOLSZ, and TBCI::thrno.
Referenced by TBCI::tbci_memalloc_cache< T >::find_and_rmv().
| void TBCI::tbci_memalloc_cache< T >::enter | ( | const T *const | ptr, | |
| const unsigned | ln | |||
| ) | [inline] |
Enter into list of FREE slots.
Definition at line 427 of file malloc_cache.h.
References TBCI::tbci_memalloc_cache< T >::malloc_tls, TBCI_MALLOC_POOLSZ, and TBCI::thrno.
Referenced by TBCI::tbci_memalloc_cache< T >::free_and_enter().
| void TBCI::tbci_memalloc_cache< T >::free_and_enter | ( | const T *const | ptr, | |
| const unsigned | ln | |||
| ) | [inline] |
Definition at line 484 of file malloc_cache.h.
References _MC_DELETE, DEBUG_PRINTF4, TBCI::tbci_memalloc_cache< T >::enter(), LIKELY, TBCI::tbci_memalloc_cache< T >::malloc_tls, SMP_LOCK, SMP_UNLOCK, T, TBCI::thrno, and UNLIKELY.
Referenced by TBCI::tbci_memalloc_cache< T >::dealloc().
| void TBCI::tbci_memalloc_cache< T >::rmv | ( | const unsigned | idx | ) | [inline] |
Remove from list of FREE slots.
Definition at line 438 of file malloc_cache.h.
References TBCI::tbci_memalloc_cache< T >::malloc_tls, and TBCI::thrno.
Referenced by TBCI::tbci_memalloc_cache< T >::find_and_rmv().
| const T * TBCI::tbci_memalloc_cache< T >::find_and_rmv | ( | const unsigned | sz | ) | [inline] |
Definition at line 446 of file malloc_cache.h.
References TBCI::tbci_memalloc_cache< T >::find_by_sz(), LIKELY, TBCI::tbci_memalloc_cache< T >::malloc_tls, TBCI::tbci_memalloc_cache< T >::rmv(), SMP_LOCK, SMP_UNLOCK, T, and TBCI::thrno.
Referenced by TBCI::tbci_memalloc_cache< T >::alloc().
| T * TBCI::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 461 of file malloc_cache.h.
References _MC_NEW, BCHK, DEBUG_PRINTF3, TBCI::tbci_memalloc_cache< T >::find_and_rmv(), TBCI::ismainthread, TBCI::tbci_memalloc_cache< T >::malloc_tls, T, TBCI_MALLOC_LIMIT, TBCI::thrno, and UNLIKELY.
| void TBCI::tbci_memalloc_cache< T >::dealloc | ( | const T * const | ptr, | |
| const unsigned long | sz | |||
| ) | [inline] |
Definition at line 502 of file malloc_cache.h.
References _MC_DELETE, BCHK, CSTD__, TBCI::tbci_memalloc_cache< T >::free_and_enter(), TBCI::ismainthread, T, TBCI_MALLOC_LIMIT, and UNLIKELY.
| static void TBCI::tbci_memalloc_cache< T >::_init | ( | tbci_memalloc_cache< T > * | th, | |
| const int | thr | |||
| ) | [inline, static] |
Definition at line 291 of file malloc_cache.h.
| static void TBCI::tbci_memalloc_cache< T >::_deinit | ( | tbci_memalloc_cache< T > * | th, | |
| const int | thr | |||
| ) | [inline, static] |
Definition at line 305 of file malloc_cache.h.
| void TBCI::tbci_memalloc_cache< T >::deinit | ( | const int | thr | ) | [inline] |
Definition at line 522 of file malloc_cache.h.
References _MC_DELETE, DEBUG_PRINTF1, DEBUG_PRINTF3, TBCI::tbci_memalloc_cache< T >::malloc_tls, T, and TBCI_MALLOC_POOLSZ.
| void TBCI::tbci_memalloc_cache< T >::init | ( | const int | thr | ) | [inline] |
Definition at line 309 of file malloc_cache.h.
| void TBCI::tbci_memalloc_cache< T >::smp_init | ( | ) | [inline] |
Definition at line 323 of file malloc_cache.h.
Referenced by TBCI::tbci_memalloc_cache< floatptr >::_init().
| void TBCI::tbci_memalloc_cache< T >::smp_deinit | ( | ) | [inline] |
Definition at line 331 of file malloc_cache.h.
Referenced by TBCI::tbci_memalloc_cache< floatptr >::_deinit().
| tbci_memalloc_cache_tls<T>* TBCI::tbci_memalloc_cache< T >::malloc_tls |
Definition at line 275 of file malloc_cache.h.
Referenced by TBCI::tbci_memalloc_cache< floatptr >::_init(), TBCI::tbci_memalloc_cache< T >::alloc(), TBCI::tbci_memalloc_cache< T >::deinit(), TBCI::tbci_memalloc_cache< T >::enter(), TBCI::tbci_memalloc_cache< T >::find_and_rmv(), TBCI::tbci_memalloc_cache< T >::find_by_sz(), TBCI::tbci_memalloc_cache< T >::free_and_enter(), and TBCI::tbci_memalloc_cache< T >::rmv().
| int TBCI::tbci_memalloc_cache< T >::nthr |
Definition at line 280 of file malloc_cache.h.
Referenced by TBCI::tbci_memalloc_cache< floatptr >::_init(), and TBCI::tbci_memalloc_cache< T >::find_by_sz().
1.5.6