Show / Hide Table of Contents

Class MemoryAllocator

Represents interop layer between .NET memory pools and MemoryAllocator<T>.

Inheritance
Object
MemoryAllocator
Inherited Members
Object.Equals(Object)
Object.Equals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Object.ReferenceEquals(Object, Object)
Object.ToString()
Namespace: DotNext.Buffers
Assembly: DotNext.dll
Syntax
public static class MemoryAllocator

Methods

| Improve this Doc View Source

CreateArrayAllocator<T>()

Returns array allocator.

Declaration
public static MemoryAllocator<T> CreateArrayAllocator<T>()
Returns
Type Description
MemoryAllocator<T>

The array allocator.

Type Parameters
Name Description
T

The type of elements in the array.

| Improve this Doc View Source

Invoke<T>(MemoryAllocator<T>, Int32, Boolean)

Allocates memory.

Declaration
public static MemoryOwner<T> Invoke<T>(this MemoryAllocator<T> allocator, int length, bool exactSize)
Parameters
Type Name Description
MemoryAllocator<T> allocator

The memory allocator.

Int32 length

The number of items in the rented memory.

Boolean exactSize

true to ask allocator to allocate exactly length; false to allocate at least length.

Returns
Type Description
MemoryOwner<T>

The allocated memory.

Type Parameters
Name Description
T

The type of the items in the memory pool.

| Improve this Doc View Source

ToAllocator<T>(ArrayPool<T>)

Converts array pool to the memory allocator.

Declaration
public static MemoryAllocator<T> ToAllocator<T>(this ArrayPool<T> pool)
Parameters
Type Name Description
ArrayPool<T> pool

The array pool.

Returns
Type Description
MemoryAllocator<T>

The array allocator.

Type Parameters
Name Description
T

The type of the items in the memory pool.

| Improve this Doc View Source

ToAllocator<T>(MemoryPool<T>)

Converts memory pool to the memory allocator.

Declaration
public static MemoryAllocator<T> ToAllocator<T>(this MemoryPool<T> pool)
Parameters
Type Name Description
MemoryPool<T> pool

The memory pool.

Returns
Type Description
MemoryAllocator<T>

The memory allocator.

Type Parameters
Name Description
T

The type of the items in the memory pool.

| Improve this Doc View Source

ToAllocator<T>(Func<Int32, IMemoryOwner<T>>)

Converts memory provider to the memory allocator.

Declaration
public static MemoryAllocator<T> ToAllocator<T>(this Func<int, IMemoryOwner<T>> provider)
Parameters
Type Name Description
Func<Int32, IMemoryOwner<T>> provider

The memory provider.

Returns
Type Description
MemoryAllocator<T>

The memory allocator.

Type Parameters
Name Description
T

The type of the items in the memory pool.

  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX