Show / Hide Table of Contents

Struct MemoryRental<T>

Represents the memory obtained from the pool or allocated on the stack or heap.

Namespace: DotNext.Buffers
Assembly: DotNext.dll
Syntax
public struct MemoryRental<T>
Type Parameters
Name Description
T

The type of the elements in the rented memory.

Constructors

| Improve this Doc View Source

MemoryRental(Span<T>)

Rents the memory referenced by the span.

Declaration
public MemoryRental(Span<T> span)
Parameters
Type Name Description
DotNext.Span<T> span

The span that references the memory to rent.

| Improve this Doc View Source

MemoryRental(MemoryPool<T>, Int32)

Rents the memory from the pool.

Declaration
public MemoryRental(MemoryPool<T> pool, int minBufferSize)
Parameters
Type Name Description
MemoryPool<T> pool

The memory pool.

Int32 minBufferSize

The minimum size of the memory to rent.

| Improve this Doc View Source

MemoryRental(Int32)

Rents the memory from .

Declaration
public MemoryRental(int minBufferSize)
Parameters
Type Name Description
Int32 minBufferSize

The minimum size of the memory to rent.

Properties

| Improve this Doc View Source

IsEmpty

Gets a value indicating that this object doesn't reference rented memory.

Declaration
public bool IsEmpty { get; }
Property Value
Type Description
Boolean
| Improve this Doc View Source

Item[Int32]

Gets the memory element by its index.

Declaration
public T this[int index] { get; }
Parameters
Type Name Description
Int32 index

The index of the memory element.

Property Value
Type Description
T

The managed pointer to the memory element.

| Improve this Doc View Source

Length

Gets length of the rented memory.

Declaration
public int Length { get; }
Property Value
Type Description
Int32
| Improve this Doc View Source

Span

Gets the rented memory.

Declaration
public Span<T> Span { get; }
Property Value
Type Description
DotNext.Span<T>

Methods

| Improve this Doc View Source

Dispose()

Returns the memory back to the pool.

Declaration
public void Dispose()
| Improve this Doc View Source

GetPinnableReference()

Obtains managed pointer to the first element of the rented array.

Declaration
public T GetPinnableReference()
Returns
Type Description
T

The managed pointer to the first element of the rented array.

| Improve this Doc View Source

ToString()

Gets textual representation of the rented memory.

Declaration
public override string ToString()
Returns
Type Description
String

The textual representation of the rented memory.

Operators

| Improve this Doc View Source

Implicit(Span<T> to MemoryRental<T>)

Converts the reference to the already allocated memory into the rental object.

Declaration
public static implicit operator MemoryRental<T>(Span<T> span)
Parameters
Type Name Description
DotNext.Span<T> span

The allocated memory to convert.

Returns
Type Description
MemoryRental<T>
  • Improve this Doc
  • View Source
Back to top Generated by DocFX