Browse Source

Fix concurrency problem with MemoryAllocatorValidator

pull/3028/head
Socolin 5 months ago
parent
commit
15d11515b7
  1. 12
      tests/ImageSharp.Tests/MemoryAllocatorValidator.cs

12
tests/ImageSharp.Tests/MemoryAllocatorValidator.cs

@ -22,7 +22,10 @@ public static class MemoryAllocatorValidator
TestMemoryDiagnostics backing = LocalInstance.Value;
if (backing != null)
{
backing.TotalRemainingAllocated--;
lock (backing)
{
backing.TotalRemainingAllocated--;
}
}
}
@ -31,8 +34,11 @@ public static class MemoryAllocatorValidator
TestMemoryDiagnostics backing = LocalInstance.Value;
if (backing != null)
{
backing.TotalAllocated++;
backing.TotalRemainingAllocated++;
lock (backing)
{
backing.TotalAllocated++;
backing.TotalRemainingAllocated++;
}
}
}

Loading…
Cancel
Save