Namespace CryptoHives.Foundation.Memory.Buffers
Classes
- AllocatedSegment<T>
An ISegmentOwner<T> that wraps a GC-managed
Tarray in an ArraySegment<T>. The underlying array is eligible for garbage collection; Dispose() only clears the segment wrapper.
- ArrayPoolBufferWriter<T>
Helper to build a ReadOnlySequence<T> from a set of buffers. Implements IBufferWriter<T> interface.
- ArrayPoolMemoryStream
Class to create a MemoryStream which uses ArrayPool buffers.
- EmptySegment<T>
An ISegmentOwner<T> that represents an empty, zero-allocation segment backed by Empty<T>(). Follows the null-object pattern to avoid null checks in consumers.
- EmptySequence<T>
An ISequenceOwner<T> that represents an empty, zero-allocation sequence backed by Empty. Follows the null-object pattern to avoid null checks in consumers.
- PooledSegment<T>
An ISegmentOwner<T> that rents a buffer from Shared and returns it automatically on dispose.
- ReadOnlySequenceMemoryStream
Class to create a read only MemoryStream which uses a ReadOnlySequence<T> as the buffer source.
- SegmentSequence<T>
An ISequenceOwner<T> that adapts a single ISegmentOwner<T> into a one-node ReadOnlySequence<T>, taking over its lifetime.
Structs
- SequenceLease<T>
A payload and the disposable that ends its life, carried together as a single value so the pair can travel through a pipeline without the consumer knowing what produced it.
Interfaces
- ISegmentOwner<T>
Owner of an ArraySegment<T> that controls the lifetime of its underlying memory. Implementors decide the acquisition and release strategy (pool return, GC collection, or no-op) while callers use a single consistent API.
- ISequenceOwner<T>
Owner of a ReadOnlySequence<T> that controls the lifetime of the buffers behind it. Implementors decide the release strategy (pool return, GC collection, or no-op) while callers use a single consistent API.