Table of Contents

Class StackedMemoryPool

Namespace
NumSharp.Unmanaged.Memory
Assembly
NumSharp.dll

Pool of allocated buffers managed by internal garbage collection mechanism.

public class StackedMemoryPool : IDisposable
Inheritance
StackedMemoryPool
Implements
Inherited Members
Extension Methods

Remarks

Used to speed up scalar allocation. Thread-safe.

Constructors

StackedMemoryPool(int)

public StackedMemoryPool(int totalSize)

Parameters

totalSize int

StackedMemoryPool(int, int)

public StackedMemoryPool(int singleSize, int count)

Parameters

singleSize int
count int

Fields

GarbageCollectionDelay

After how many milliseconds should unused excess memory be deallocated. (only if allocated exceeded above 133% of firstly allocated).
Default: 5000ms.

public int GarbageCollectionDelay

Field Value

int

SingleSize

public readonly int SingleSize

Field Value

int

Properties

Available

How many pointers are currently preallocated and available for the taking.

public long Available { get; }

Property Value

long

TotalAllocated

How many Scalar pointers are allocated.

public long TotalAllocated { get; }

Property Value

long

Methods

AllocateBytes(long)

public void AllocateBytes(long bytes)

Parameters

bytes long

AllocateCount(long)

public void AllocateCount(long count)

Parameters

count long

Dispose()

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

public void Dispose()

~StackedMemoryPool()

protected ~StackedMemoryPool()

Return(nint)

public void Return(nint x)

Parameters

x nint

Take()

public nint Take()

Returns

nint

TrimExcess()

public void TrimExcess()

UpdateGarbageCollectionThreshold()

Set the point of GC activation to the current TotalAllocated multiplied by 1.33.

public void UpdateGarbageCollectionThreshold()