Class BumpAllocator<T>
An allocator that can never free individual allocations.
public class BumpAllocator<T> : IAllocator<T>, IAllocator, IDisposable where T : struct
Type Parameters
T
The value type.
- Inheritance
-
BumpAllocator<T>
- Implements
-
IAllocator<T>
- Derived
- Inherited Members
Fields
heap
protected T[] heap
Field Value
- T[]
lk
protected readonly object lk
Field Value
tail
protected int tail
Field Value
token
protected readonly DisposeTokenSource token
Field Value
Properties
AllocatedBytes
Amount of memory allocated in bytes.
public long AllocatedBytes { get; }
Property Value
CapacityBytes
Maximum number of bytes available for this arena.
public long CapacityBytes { get; set; }
Property Value
ComittedBytes
Amount of heap memory comitted for this arena.
public long ComittedBytes { get; }
Property Value
Granularity
How many objects to commit at a time.
public int Granularity { get; set; }
Property Value
Methods
Allocate(int)
public BumpAllocation<T> Allocate(int size)
Parameters
size
int
Returns
Break(int)
protected void Break(int tail)
Parameters
tail
int
Clear(bool)
Clear all allocations in this arena.
public void Clear(bool uncommit = false)
Parameters
uncommit
boolTrue to uncommit the allocated memory pool
Remarks
Invalidates all allocations.
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()