Table of Contents

Class BumpAllocator<T>

Namespace
ReFuel.Memory
Assembly
ReFuel.dll

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
Derived
Inherited Members

Fields

heap

protected T[] heap

Field Value

T[]

lk

protected readonly object lk

Field Value

object

tail

protected int tail

Field Value

int

token

protected readonly DisposeTokenSource token

Field Value

DisposeTokenSource

Properties

AllocatedBytes

Amount of memory allocated in bytes.

public long AllocatedBytes { get; }

Property Value

long

CapacityBytes

Maximum number of bytes available for this arena.

public long CapacityBytes { get; set; }

Property Value

long

ComittedBytes

Amount of heap memory comitted for this arena.

public long ComittedBytes { get; }

Property Value

long

Granularity

How many objects to commit at a time.

public int Granularity { get; set; }

Property Value

int

Methods

Allocate(int)

public BumpAllocation<T> Allocate(int size)

Parameters

size int

Returns

BumpAllocation<T>

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 bool

True 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()