Skip to content

Class Arena

Namespace: Apogee.Core.Memory
Assembly: Apogee.Core.dll

A fixed-size bump allocator over unmanaged memory. Allocations are zeroed and live until ; the memory never moves, so pointers and spans into it stay valid. Not thread safe.

public sealed class Arena : IDisposable

Inheritance

object ← Arena

Implements

IDisposable

Inherited Members

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()

Constructors

Arena(nuint)

public Arena(nuint capacity)

Parameters

capacity nuint

Properties

Capacity

public nuint Capacity { get; }

Property Value

nuint

Mark

A position to back to, freeing everything allocated after it.

public nuint Mark { get; }

Property Value

nuint

Used

public nuint Used { get; }

Property Value

nuint

Methods

Allocate<T>(int)

public Span<T> Allocate<T>(int count) where T : unmanaged

Parameters

count int

Returns

Span<T>

Type Parameters

T

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

\~Arena()

protected ~Arena()

Reset(nuint)

public void Reset(nuint mark = 0)

Parameters

mark nuint