Table of Contents

Class MemoryPool<T>

Namespace
MarymoorStudios.Core
Assembly
MarymoorStudios.Core.dll

A pool of memory blocks.

public abstract class MemoryPool<T> : IDisposable where T : unmanaged

Type Parameters

T
Inheritance
MemoryPool<T>
Implements
Derived
Inherited Members

Constructors

MemoryPool()

protected MemoryPool()

Properties

MaxSize

Returns the maximum buffer size supported by this pool.

public abstract int MaxSize { get; }

Property Value

int

Remarks

The buffer size is the maximum number of T elements that a memory can contain.

Note: This value must be constant for the lifetime of the pool.

Methods

Dispose()

public void Dispose()

Dispose(bool)

Implements standard Dispose-pattern.

protected abstract void Dispose(bool disposing)

Parameters

disposing bool

True if disposing, false if finalizing.

Remarks

When disposing is true then managed resources should be released. When disposing is false then the object has already gone through garbage collection and only native resources should be touched.

~MemoryPool()

protected ~MemoryPool()

GetMemory()

Returns Memory<T> of size MaxSize.

public abstract OwnedMem<T> GetMemory()

Returns

OwnedMem<T>

GetMemory(int)

Returns Memory<T> of size size.

public OwnedMem<T> GetMemory(int size)

Parameters

size int

Returns

OwnedMem<T>