Navigation
API > API/Runtime > API/Runtime/Engine
References
| Module | Engine |
| Header | /Engine/Source/Runtime/Engine/Public/SpanAllocator.h |
| Include | #include "SpanAllocator.h" |
Syntax
class FSpanAllocator
Remarks
Allocator for spans from some range that is allowed to grow and shrink to accomodate the allocations. Implementation is biased towards the case where allocations and frees are performed in bulk, if they are interleaved performance will degrade. Prefers allocations at the start of the range, such that the high-watermark can be reduced optimally. Primarily optimized for the use-case where span size == 1, for variable span size allocation performance is sub-optimal as it does not accelerate the search for larger allocs.
Constructors
| Type | Name | Description | |
|---|---|---|---|
FSpanAllocator
(
bool bInGrowOnly |
If bInGrowOnly is true the size reported by GetMaxSize() will never decrease except when for when Reset() or Empty() is called. |
Functions
| Type | Name | Description | |
|---|---|---|---|
| int32 | Allocate
(
int32 Num |
Allocate a range. Returns allocated StartOffset. | |
| void | Consolidate () |
Between these calls to Free just appends the allocation to the free list, rather than trying to merge with existing allocations. | |
| void | Empty () |
||
| void | Free
(
int32 BaseOffset, |
Free an already allocated range. | |
| SIZE_T | |||
| int32 | GetMaxSize () |
||
| int32 | |||
| int32 | |||
| int32 | |||
| bool | IsFree
(
int32 Index |
Loop over all free spans and check if Index is in any of them. | |
| void | Reset () |