diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1ShaderCompiler.cs b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1ShaderCompiler.cs index ac459e8b..8e3f9ae9 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1ShaderCompiler.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1ShaderCompiler.cs @@ -44,7 +44,12 @@ public static class D2D1ShaderCompiler ReadOnlySpan sourceAscii = sourceBuffer.AsSpan(0, sourceWrittenBytes); ReadOnlySpan entryPointAscii = entryPointBuffer.AsSpan(0, entryPointWrittenBytes); - return Compile(sourceAscii, entryPointAscii, shaderProfile, options); + ReadOnlyMemory bytecode = Compile(sourceAscii, entryPointAscii, shaderProfile, options); + + ArrayPool.Shared.Return(sourceBuffer); + ArrayPool.Shared.Return(entryPointBuffer); + + return bytecode; } ///