Memory
Represents methods to work with memory pools and buffers.
Allocates memory of at least length size.
Rents a block of memory of at least
length size from Shared pool.
Allocates memory of length size.
Rents a block of memory of the specified size from Shared pool.
Converts two memory blocks to ReadOnlySequence<T> data type.
public static void CopyTo<T>(this ref ReadOnlySequence source, Span<T> destination, out int writtenCount)
Copies the contents from the source sequence into a destination span.
Returns array allocator.
public static MemoryAllocator<T> GetPinnedArrayAllocator<T>() where T : ValueType modreq(System.Runtime.InteropServices.UnmanagedType)
Returns an allocator of pinned arrays.
Gets managed pointer to the first element in the rented memory block.
Releases all resources encapsulated by the container.
public static void Resize<T>(this ref MemoryOwner owner, int newLength, MemoryAllocator<T> allocator = null)
Resizes the buffer.
Converts array pool to the memory allocator.
Converts memory pool to the memory allocator.
Converts memory provider to the memory allocator.
Converts the sequence of memory blocks to ReadOnlySequence<T> data type.
Constructs a sequence of characters from a collection of strings.
Trims the memory block to specified length if it exceeds it.
If length is less that maxLength then the original block returned.
Trims the memory block to specified length if it exceeds it.
If length is less that maxLength then the original block returned.
public static bool TryGetBlock<T>(this ref ReadOnlySequence sequence, int count, out ReadOnlyMemory span)
Tries to get a contiguous block of memory from the specified sequence of elements.