Slice.Pinned

Namespace: System · struct

Implements: IDisposable

Structure that keeps buffers from moving in memory during GC collections

Remarks

Caller must ensure that this structure is properly Disposed in all executions paths once the buffers are not needed anymore! It is safe to call Dispose() multiple times (though the buffers will be unpinned on the first call)

Constructors

Pinned

Pinned(object owner, byte[] buffer, List<Slice> extra)

Creates a pinned handle for a slice

Properties

IsAllocated

bool IsAllocated { get; }

Methods

Dispose

void Dispose()

Fields

Handle

GCHandle Handle

GC Handle on the main buffer