Module |
|
Header |
/Engine/Source/Runtime/Core/Public/Containers/AllocatorFixedSizeFreeList.h |
Include |
#include "Containers/AllocatorFixedSizeFreeList.h" |
Fixed-sized allocator that uses a free list to cache allocations. Initial allocation block can be specified in the ctor to warm the cache. Subsequent allocations are in multiples of the given blocksize.
Grow can be called at any time to warm the cache with a single block allocation. Initial allocation will want to be a reasonable guess as to how big the pool might grow. BlockSize should be small enough to cut down on allocations but not overcommit memory.
Currently there is not way to flush the pool because it doesn't track each block's allocation status. Not threadsafe <could be="" implemented="" using="" a="" threadingpolicy="" template="" parameter>="">.
Template params: AllocationSize - size of each allocation (must be at least as large as a pointer) BlockSize - number of allocations to reserve room for when a new block needs to be allocated.
Name | Description | |
---|---|---|
|
TAllocatorFixedSizeFreeList ( |
Ctor |
Name | Description | |
---|---|---|
|
~TAllocatorFixedSizeFreeList() |
|
Name | Description | ||
---|---|---|---|
|
void * |
Allocate() |
Allocates one element from the free list. Return it by calling Free. |
|
Free ( |
Returns one element from the free list. Must have been acquired previously by Allocate. |
|
|
GetAllocatedSize() |
Get total memory allocated. |
|
|
Grow ( |
Grows the free list by a specific number of elements. |