Class StackedMemoryPool
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
totalSizeint
StackedMemoryPool(int, int)
public StackedMemoryPool(int singleSize, int count)
Parameters
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
SingleSize
public readonly int SingleSize
Field Value
Properties
Available
How many pointers are currently preallocated and available for the taking.
public long Available { get; }
Property Value
TotalAllocated
How many Scalar pointers are allocated.
public long TotalAllocated { get; }
Property Value
Methods
AllocateBytes(long)
public void AllocateBytes(long bytes)
Parameters
byteslong
AllocateCount(long)
public void AllocateCount(long count)
Parameters
countlong
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
xnint
Take()
public nint Take()
Returns
TrimExcess()
public void TrimExcess()
UpdateGarbageCollectionThreshold()
Set the point of GC activation to the current TotalAllocated multiplied by 1.33.
public void UpdateGarbageCollectionThreshold()