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()
public SimpleGcMemoryAllocator()
Methods
Allocate<T>(int, AllocationOptions)
Allocates an IMemoryOwner<T>, holding a Memory<T> of length length
.
public override IMemoryOwner<T> Allocate<T>(int length, AllocationOptions options = AllocationOptions.None) where T : struct
Parameters
length
intSize of the buffer to allocate.
options
AllocationOptionsThe allocation options.
Returns
- IMemoryOwner<T>
A buffer of values of type
T
.
Type Parameters
T
Type of the data stored in the buffer.
Exceptions
- 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.
protected override int GetBufferCapacityInBytes()
Returns
- int
The length of the largest contiguous buffer that can be handled by this allocator instance.