Browse Source

MemoryAllocatorSettings -> MemoryAllocatorOptions

pull/1730/head
Anton Firszov 5 years ago
parent
commit
f10da94830
  1. 2
      src/ImageSharp/Configuration.cs
  2. 6
      src/ImageSharp/Memory/Allocators/MemoryAllocator.cs
  3. 2
      src/ImageSharp/Memory/Allocators/MemoryAllocatorOptions.cs
  4. 2
      tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedPoolMemoryAllocatorTests.cs

2
src/ImageSharp/Configuration.cs

@ -134,7 +134,7 @@ namespace SixLabors.ImageSharp
/// </summary>
/// <remarks>
/// It's possible to reduce allocator footprint by assigning a custom instance created with
/// <see cref="Memory.MemoryAllocator.Create(MemoryAllocatorSettings)"/>, but note that since the default pooling
/// <see cref="Memory.MemoryAllocator.Create(MemoryAllocatorOptions)"/>, but note that since the default pooling
/// allocators are expensive, it is strictly recommended to use a single process-wide allocator.
/// You can ensure this by altering the allocator of <see cref="Default"/>, or by implementing custom application logic that
/// manages allocator lifetime.

6
src/ImageSharp/Memory/Allocators/MemoryAllocator.cs

@ -37,10 +37,10 @@ namespace SixLabors.ImageSharp.Memory
/// <summary>
/// Creates the default <see cref="MemoryAllocator"/> using the provided options.
/// </summary>
/// <param name="settings">The <see cref="MemoryAllocatorSettings"/>.</param>
/// <param name="options">The <see cref="MemoryAllocatorOptions"/>.</param>
/// <returns>The <see cref="MemoryAllocator"/>.</returns>
public static MemoryAllocator Create(MemoryAllocatorSettings settings) =>
new UniformUnmanagedMemoryPoolMemoryAllocator(settings.MaximumPoolSizeMegabytes);
public static MemoryAllocator Create(MemoryAllocatorOptions options) =>
new UniformUnmanagedMemoryPoolMemoryAllocator(options.MaximumPoolSizeMegabytes);
/// <summary>
/// Allocates an <see cref="IMemoryOwner{T}" />, holding a <see cref="Memory{T}"/> of length <paramref name="length"/>.

2
src/ImageSharp/Memory/Allocators/MemoryAllocatorSettings.cs → src/ImageSharp/Memory/Allocators/MemoryAllocatorOptions.cs

@ -6,7 +6,7 @@ namespace SixLabors.ImageSharp.Memory
/// <summary>
/// Defines options for creating the default <see cref="MemoryAllocator"/>.
/// </summary>
public struct MemoryAllocatorSettings
public struct MemoryAllocatorOptions
{
private int? maximumPoolSizeMegabytes;

2
tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedPoolMemoryAllocatorTests.cs

@ -151,7 +151,7 @@ namespace SixLabors.ImageSharp.Tests.Memory.Allocators
static void RunTest()
{
var allocator = MemoryAllocator.Create(new MemoryAllocatorSettings()
var allocator = MemoryAllocator.Create(new MemoryAllocatorOptions()
{
MaximumPoolSizeMegabytes = 8
});

Loading…
Cancel
Save