diff --git a/src/ImageSharp/Memory/ArrayPoolMemoryManager.cs b/src/ImageSharp/Memory/ArrayPoolMemoryManager.cs
index 3e5628c75..f77a1f8ac 100644
--- a/src/ImageSharp/Memory/ArrayPoolMemoryManager.cs
+++ b/src/ImageSharp/Memory/ArrayPoolMemoryManager.cs
@@ -30,7 +30,13 @@ namespace SixLabors.ImageSharp.Memory
}
///
- internal override Buffer Allocate(int itemCount, bool clear = false)
+ internal override Buffer Allocate(int itemCount)
+ {
+ return this.Allocate(itemCount, false);
+ }
+
+ ///
+ internal override Buffer Allocate(int itemCount, bool clear)
{
int itemSizeBytes = Unsafe.SizeOf();
int bufferSizeInBytes = itemCount * itemSizeBytes;
diff --git a/src/ImageSharp/Memory/MemoryManager.cs b/src/ImageSharp/Memory/MemoryManager.cs
index 67d72d2b4..1cefccfb2 100644
--- a/src/ImageSharp/Memory/MemoryManager.cs
+++ b/src/ImageSharp/Memory/MemoryManager.cs
@@ -11,6 +11,17 @@ namespace SixLabors.ImageSharp.Memory
///
public abstract class MemoryManager
{
+ ///
+ /// Allocates a of size .
+ /// Note: Depending on the implementation, the buffer may not cleared before
+ /// returning, so it may contain data from an earlier use.
+ ///
+ /// Type of the data stored in the buffer
+ /// Size of the buffer to allocate
+ /// A buffer of values of type .
+ internal abstract Buffer Allocate(int size)
+ where T : struct;
+
///
/// Allocates a of size , optionally
/// clearing the buffer before it gets returned.
@@ -19,7 +30,7 @@ namespace SixLabors.ImageSharp.Memory
/// Size of the buffer to allocate
/// True to clear the backing memory of the buffer
/// A buffer of values of type .
- internal abstract Buffer Allocate(int size, bool clear = false)
+ internal abstract Buffer Allocate(int size, bool clear)
where T : struct;
///
diff --git a/src/ImageSharp/Memory/NullMemoryManager.cs b/src/ImageSharp/Memory/NullMemoryManager.cs
index 32642dae4..d82f01353 100644
--- a/src/ImageSharp/Memory/NullMemoryManager.cs
+++ b/src/ImageSharp/Memory/NullMemoryManager.cs
@@ -6,7 +6,13 @@
public class NullMemoryManager : MemoryManager
{
///
- internal override Buffer Allocate(int size, bool clear = false)
+ internal override Buffer Allocate(int size)
+ {
+ return new Buffer(new T[size], size);
+ }
+
+ ///
+ internal override Buffer Allocate(int size, bool clear)
{
return new Buffer(new T[size], size);
}