dispenso 1.4.1
A library for task parallelism
Loading...
Searching...
No Matches
dispenso::PoolAllocatorT< kThreadSafe > Class Template Reference

#include <pool_allocator.h>

Public Member Functions

DISPENSO_DLL_ACCESS PoolAllocatorT (size_t chunkSize, size_t allocSize, std::function< void *(size_t)> allocFunc, std::function< void(void *)> deallocFunc)
 
DISPENSO_DLL_ACCESS void clear ()
 
size_t totalChunkCapacity () const
 
DISPENSO_DLL_ACCESS ~PoolAllocatorT ()
 

Detailed Description

template<bool kThreadSafe>
class dispenso::PoolAllocatorT< kThreadSafe >

A pool allocator to help reduce calls to the underlying allocation and deallocation functions.

Definition at line 30 of file pool_allocator.h.

Constructor & Destructor Documentation

◆ PoolAllocatorT()

template<bool kThreadSafe>
DISPENSO_DLL_ACCESS dispenso::PoolAllocatorT< kThreadSafe >::PoolAllocatorT ( size_t chunkSize,
size_t allocSize,
std::function< void *(size_t)> allocFunc,
std::function< void(void *)> deallocFunc )

Construct a PoolAllocator.

Parameters
chunkSizeThe chunk size for each pool allocation
allocSizeThe size of underlying slabs to be chunked
allocFuncThe underlying allocation function for allocating slabs
deallocFuncThe underlying deallocation function. Currently only called on destruction.

◆ ~PoolAllocatorT()

template<bool kThreadSafe>
DISPENSO_DLL_ACCESS dispenso::PoolAllocatorT< kThreadSafe >::~PoolAllocatorT ( )

Destruct a PoolAllocator

Member Function Documentation

◆ clear()

template<bool kThreadSafe>
DISPENSO_DLL_ACCESS void dispenso::PoolAllocatorT< kThreadSafe >::clear ( )

Effectively dealloc all previously allocated chunks. Useful for arenas. This function is not thread safe, and no previously allocated chunks may be dealloc'd after clear.

◆ totalChunkCapacity()

template<bool kThreadSafe>
size_t dispenso::PoolAllocatorT< kThreadSafe >::totalChunkCapacity ( ) const
inline

Get the total capicity allocated in chunks (how many alloc() could be called without triggering allocFunc() if all chunks were available)

Definition at line 71 of file pool_allocator.h.


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