Class SimpleGcMemoryAllocator
Implements MemoryAllocator by newing up managed arrays on every allocation request.
Inherited Members
Namespace: SixLabors.ImageSharp.Memory
Assembly: SixLabors.ImageSharp.dll
Syntax
public sealed class SimpleGcMemoryAllocator : MemoryAllocator
Methods
| Edit this page View SourceAllocate<T>(int, AllocationOptions)
Allocates an IMemoryOwner<T>, holding a Memory<T> of length length
.
Declaration
public override IMemoryOwner<T> Allocate<T>(int length, AllocationOptions options = AllocationOptions.None) where T : struct
Parameters
Type | Name | Description |
---|---|---|
int | length | Size of the buffer to allocate. |
AllocationOptions | options | The allocation options. |
Returns
Type | Description |
---|---|
IMemoryOwner<T> | A buffer of values of type |
Type Parameters
Name | Description |
---|---|
T | Type of the data stored in the buffer. |
Overrides
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | When length is zero or negative. |
InvalidMemoryOperationException | When length is over the capacity of the allocator. |
GetBufferCapacityInBytes()
Gets the length of the largest contiguous buffer that can be handled by this allocator instance in bytes.
Declaration
protected override int GetBufferCapacityInBytes()
Returns
Type | Description |
---|---|
int | The length of the largest contiguous buffer that can be handled by this allocator instance. |