Skip to content

Commit

Permalink
Update memory alloctor initialisation
Browse files Browse the repository at this point in the history
Updates to use the new and default `ArrayPool`-based memory allocator
(see SixLabors/ImageSharp#1730).
  • Loading branch information
frenzibyte committed Apr 1, 2022
1 parent 2da8525 commit 1f41f14
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions osu.Framework.Benchmarks/BenchmarkFontLoading.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class BenchmarkFontLoading : BenchmarkTest

public override void SetUp()
{
SixLabors.ImageSharp.Configuration.Default.MemoryAllocator = ArrayPoolMemoryAllocator.CreateDefault();
SixLabors.ImageSharp.Configuration.Default.MemoryAllocator = MemoryAllocator.Default;

baseResources = new NamespacedResourceStore<byte[]>(new DllResourceStore(@"osu.Framework.dll"), @"Resources");
sharedTemp = new TemporaryNativeStorage("fontstore-test-" + Guid.NewGuid());
Expand Down Expand Up @@ -66,7 +66,7 @@ public void BenchmarkNoCache()
[Benchmark]
public void BenchmarkTimedExpiry()
{
SixLabors.ImageSharp.Configuration.Default.MemoryAllocator = ArrayPoolMemoryAllocator.CreateDefault();
SixLabors.ImageSharp.Configuration.Default.MemoryAllocator = MemoryAllocator.Default;

using (var store = new TimedExpiryGlyphStore(baseResources, font_name))
runFor(store);
Expand Down
4 changes: 2 additions & 2 deletions osu.Framework/Platform/GameHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -667,8 +667,8 @@ public void Run(Game game)

if (LimitedMemoryEnvironment)
{
// recommended middle-ground https://github.com/SixLabors/docs/blob/master/articles/ImageSharp/MemoryManagement.md#working-in-memory-constrained-environments
SixLabors.ImageSharp.Configuration.Default.MemoryAllocator = ArrayPoolMemoryAllocator.CreateWithModeratePooling();
// recommended middle-ground https://github.com/SixLabors/docs/blob/main/articles/imagesharp/memorymanagement.md#configuring-the-pool-size
SixLabors.ImageSharp.Configuration.Default.MemoryAllocator = MemoryAllocator.Create(new MemoryAllocatorOptions { MaximumPoolSizeMegabytes = 1 });
}

if (ExecutionState != ExecutionState.Idle)
Expand Down

0 comments on commit 1f41f14

Please sign in to comment.