Table of Contents

Class SimpleGcMemoryAllocator

Namespace
SixLabors.ImageSharp.Memory
Assembly
SixLabors.ImageSharp.dll

Implements MemoryAllocator by newing up managed arrays on every allocation request.

public sealed class SimpleGcMemoryAllocator : MemoryAllocator
Inheritance
SimpleGcMemoryAllocator
Inherited Members
Extension Methods

Constructors

SimpleGcMemoryAllocator()

Initializes a new instance of the SimpleGcMemoryAllocator class with default limits.

public SimpleGcMemoryAllocator()

SimpleGcMemoryAllocator(MemoryAllocatorOptions)

Initializes a new instance of the SimpleGcMemoryAllocator class with custom limits.

public SimpleGcMemoryAllocator(MemoryAllocatorOptions options)

Parameters

options MemoryAllocatorOptions

The MemoryAllocatorOptions to apply.

Methods

AllocateCore<T>(int, AllocationOptions)

Allocates a tracked memory owner for Allocate<T>(int, AllocationOptions).

protected override AllocationTrackedMemoryManager<T> AllocateCore<T>(int length, AllocationOptions options = AllocationOptions.None) where T : struct

Parameters

length int

Size of the buffer to allocate.

options AllocationOptions

The allocation options.

Returns

AllocationTrackedMemoryManager<T>

A tracked memory owner of values of type T.

Type Parameters

T

Type of the data stored in the buffer.

Remarks

Implementations should only allocate and initialize the concrete owner. The base allocator reserves bytes, attaches tracking to the returned owner, and releases the reservation if allocation fails.

GetBufferCapacityInBytes()

Gets the length of the largest contiguous buffer that can be handled by this allocator instance in bytes.

protected override int GetBufferCapacityInBytes()

Returns

int

The length of the largest contiguous buffer that can be handled by this allocator instance.