A specialization of a pool which can allocate new elements dynamically upon request.
More...
#include <Buffer.hxx>
|
| | DynamicPool (Bucket sizes[]) |
| | Constructor.
|
| |
| | ~DynamicPool () |
| | default destructor
|
| |
| size_t | free_items () override |
| | Number of free items in the pool.
|
| |
| size_t | free_items (size_t size) override |
| | Number of free items in the pool for a given allocation size.
|
| |
| size_t | total_size () |
| |
| template<class BufferType > |
| void | alloc (Buffer< BufferType > **result, Executable *flow=NULL) |
| | Get a free item out of the pool.
|
| |
| template<class BufferType > |
| void | alloc (BufferPtr< BufferType > *result) |
| | Get a free item out of the pool.
|
| |
| template<class BufferType > |
| void | alloc_async (Executable *flow) |
| | Get a free item out of the pool.
|
| |
|
| BufferBase * | alloc_untyped (size_t size, Executable *flow) override |
| | Get a free item out of the pool.
|
| |
| void * | alloc_large (size_t size) |
| | Allocates a large memory block directly from the heap.
|
| |
| void | free_large (void *block) |
| | Frees a large memory block allocated by alloc_large.
|
| |
| void | free (BufferBase *item) override |
| | Releases an item back to the free pool.
|
| |
|
| DynamicPool () |
| | Default constructor.
|
| |
|
| DISALLOW_COPY_AND_ASSIGN (DynamicPool) |
| |
| void | lock () |
| |
| void | unlock () |
| |
|
| template<class BufferType > |
| static void | alloc_async_init (BufferBase *base, Buffer< BufferType > **result) |
| | Cast the result of an asynchronous allocation and perform a placement new on it.
|
| |
| | Pool () |
| | Default Constructor.
|
| |
| virtual | ~Pool () |
| | default destructor.
|
| |
A specialization of a pool which can allocate new elements dynamically upon request.
Definition at line 490 of file Buffer.hxx.
◆ DynamicPool()
| DynamicPool::DynamicPool |
( |
Bucket |
sizes[] | ) |
|
|
inline |
Constructor.
- Parameters
-
| sizes | array of bucket sizes for the pool |
Definition at line 496 of file Buffer.hxx.
◆ ~DynamicPool()
| DynamicPool::~DynamicPool |
( |
| ) |
|
|
inline |
◆ alloc_large()
| void * DynamicPool::alloc_large |
( |
size_t |
size | ) |
|
|
private |
Allocates a large memory block directly from the heap.
- Parameters
-
| size | is the block size to allocate from the heap. |
- Returns
- the allocated block.
Definition at line 154 of file Buffer.cxx.
◆ alloc_untyped()
Get a free item out of the pool.
- Parameters
-
| result | pointer to a pointer to the result |
| flow | if !NULL, then the alloc call is considered async and will behave as if alloc_async() was called. |
- Returns
- the allocated buffer base. The caller has to run the constructor on the returned object to initialize to a specific type.
- Parameters
-
| size | tells how much to allocate (in bytes) |
| flow | if !NULL, then the alloc call is considered async and will behave as if alloc_async() was called. |
- Returns
- the allocated buffer.
Implements Pool.
Definition at line 105 of file Buffer.cxx.
◆ free()
Releases an item back to the free pool.
Release an item back to the free pool.
- Parameters
-
| item | pointer to item to release |
Implements Pool.
Definition at line 165 of file Buffer.cxx.
◆ free_items() [1/2]
| size_t DynamicPool::free_items |
( |
| ) |
|
|
overridevirtual |
Number of free items in the pool.
- Returns
- number of free items in the pool
Implements Pool.
Definition at line 57 of file Buffer.cxx.
◆ free_items() [2/2]
| size_t DynamicPool::free_items |
( |
size_t |
size | ) |
|
|
overridevirtual |
Number of free items in the pool for a given allocation size.
- Parameters
-
- Returns
- number of free items in the pool for a given allocation size
Implements Pool.
Definition at line 71 of file Buffer.cxx.
◆ free_large()
| void DynamicPool::free_large |
( |
void * |
block | ) |
|
|
private |
Frees a large memory block allocated by alloc_large.
- Parameters
-
| block | is the memory block to free. |
Definition at line 158 of file Buffer.cxx.
◆ ForwardAllocator
◆ buckets
The documentation for this class was generated from the following files: