MemoryPoolSlab Class

Slab tracking object used by the byte buffer memory pool. A slab is a large allocation which is divided into smaller blocks. The individual blocks are then treated as independant array segments.

Namespace
Microsoft.AspNetCore.Server.Kestrel.Internal.Infrastructure
Assemblies
  • Microsoft.AspNetCore.Server.Kestrel

Syntax

public class MemoryPoolSlab : IDisposable
class Microsoft.AspNetCore.Server.Kestrel.Internal.Infrastructure.MemoryPoolSlab

Methods

Create(System.Int32)
Return type:Microsoft.AspNetCore.Server.Kestrel.Internal.Infrastructure.MemoryPoolSlab
public static MemoryPoolSlab Create(int length)
Dispose()
public void Dispose()
Dispose(System.Boolean)
protected virtual void Dispose(bool disposing)
Finalize()
protected void Finalize()

Fields

Array()

The managed memory allocated in the large object heap.

Return type:System.Byte<System.Byte>[]
public byte[] Array
ArrayPtr()

The native memory pointer of the pinned Array. All block native addresses are pointers into the memory ranging from ArrayPtr to ArrayPtr + Array.Length

Return type:System.IntPtr
public IntPtr ArrayPtr
IsActive()

True as long as the blocks from this slab are to be considered returnable to the pool. In order to shrink the memory pool size an entire slab must be removed. That is done by (1) setting IsActive to false and removing the slab from the pool’s _slabs collection, (2) as each block currently in use is Return()ed to the pool it will be allowed to be garbage collected rather than re-pooled, and (3) when all block tracking objects are garbage collected and the slab is no longer references the slab will be garbage collected and the memory unpinned will be unpinned by the slab’s Dispose.

Return type:System.Boolean
public bool IsActive