|
dispenso 1.4.1
A library for task parallelism
|
Go to the source code of this file.
Functions | |
| template<size_t kBlockSize> | |
| char * | dispenso::allocSmallBuffer () |
| template<size_t kBlockSize> | |
| void | dispenso::deallocSmallBuffer (void *buf) |
| template<size_t kBlockSize> | |
| size_t | dispenso::approxBytesAllocatedSmallBuffer () |
Variables | |
| constexpr size_t | dispenso::kMaxSmallBufferSize = 256 |
A file providing SmallBufferAllocator. This allocator can allocate and deallocate chunks of a set size in a way that is efficient and scales quite well across many threads.
Definition in file small_buffer_allocator.h.
|
inline |
Allocate a small buffer from a small buffer pool.
| kBlockSize | The size of the block to allocate. Must be a power of two, and must be less than or equal to kMaxSmallBufferSize. |
Definition at line 88 of file small_buffer_allocator.h.
| size_t dispenso::approxBytesAllocatedSmallBuffer | ( | ) |
Get the approximate bytes allocated for a single small buffer pool (associated with kBlockSize). This function is not highly performant and locks, and should only be used for diagnostics (e.g. tests).
| kBlockSize | The block size for the pool to query. |
Definition at line 113 of file small_buffer_allocator.h.
|
inline |
Free a small buffer from a small buffer pool.
| kBlockSize | The size of the block to allocate. Must be a power of two, and must be less than or equal to kMaxSmallBufferSize. |
| buf | the pointer to block of memory to return to the pool. Must have been allocated with allocSmallBuffer templatized on the same block size. |
Definition at line 101 of file small_buffer_allocator.h.
|
constexpr |
Set a standard for the maximum chunk size for use within dispenso. The reason for this limit is that there are diminishing returns after a certain size, and each new pool has it's own memory overhead.
Definition at line 27 of file small_buffer_allocator.h.