Table of Contents

Namespace CryptoHives.Foundation.Memory.Buffers

Classes

AllocatedSegment<T>

An ISegmentOwner<T> that wraps a GC-managed T array 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.

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.

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.