Class Arena<T>
An arena for allocating any number of the same struct.
public class Arena<T> : IAllocator<T>, IAllocator, IDisposable where T : struct
Type Parameters
T
The struct type.
- Inheritance
-
Arena<T>
- Implements
-
IAllocator<T>
- Inherited Members
Constructors
Arena(int)
public Arena(int initialCapacity = 0)
Parameters
initialCapacity
int
Properties
Allocated
Number of items allocated.
public int Allocated { get; }
Property Value
AllocatedBytes
Amount of memory allocated in bytes.
public long AllocatedBytes { get; }
Property Value
Capacity
Maximum number of items to allocated.
public int Capacity { get; set; }
Property Value
CapacityBytes
Maximum number of bytes available for this arena.
public long CapacityBytes { get; set; }
Property Value
Comitted
Number of items comitted.
public int Comitted { get; }
Property Value
ComittedBytes
Amount of heap memory comitted for this arena.
public long ComittedBytes { get; }
Property Value
Methods
Allocate(int)
Allocate memory.
public IAlloaction<T> Allocate(int count)
Parameters
count
int
Returns
- IAlloaction<T>
Allocated memory.
Exceptions
- OutOfMemoryException
Ran out of memory.
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()