Table of Contents

Class NativeBuffer<TItem, TTracker>

Namespace
Apache.Arrow.Memory
Assembly
Apache.Arrow.dll
public sealed class NativeBuffer<TItem, TTracker> : IDisposable where TItem : unmanaged where TTracker : struct, INativeAllocationTracker

Type Parameters

TItem
TTracker
Inheritance
NativeBuffer<TItem, TTracker>
Implements
Inherited Members

Constructors

NativeBuffer(int, bool, TTracker)

Creates a native buffer sized for elementCount elements of TItem.

public NativeBuffer(int elementCount, bool zeroFill = true, TTracker tracker = default)

Parameters

elementCount int

Number of elements.

zeroFill bool

If true, the buffer is zeroed. Set to false if the caller will initialize the entire span itself.

tracker TTracker

Allows native allocation sizes to be tracked and affect the GC.

Properties

ByteSpan

Gets a Span<T> over the raw bytes of the native buffer.

public Span<byte> ByteSpan { get; }

Property Value

Span<byte>

Length

Number of TItem elements that fit in the buffer.

public int Length { get; }

Property Value

int

Span

Gets a Span<T> over the native buffer.

public Span<TItem> Span { get; }

Property Value

Span<TItem>

Methods

Build()

Transfers ownership to an ArrowBuffer. This instance becomes unusable.

public ArrowBuffer Build()

Returns

ArrowBuffer

Dispose()

public void Dispose()

Grow(int, bool)

Grows the buffer to hold at least newElementCount elements, preserving existing data.

public void Grow(int newElementCount, bool zeroFill = true)

Parameters

newElementCount int
zeroFill bool