diff --git a/src/ComputeSharp/Graphics/Helpers/DeviceHelper.ID3D12InfoQueue.cs b/src/ComputeSharp/Graphics/Helpers/DeviceHelper.ID3D12InfoQueue.cs
index 2ceec2b1..8a4341ee 100644
--- a/src/ComputeSharp/Graphics/Helpers/DeviceHelper.ID3D12InfoQueue.cs
+++ b/src/ComputeSharp/Graphics/Helpers/DeviceHelper.ID3D12InfoQueue.cs
@@ -16,6 +16,11 @@ namespace ComputeSharp.Graphics.Helpers;
///
internal static partial class DeviceHelper
{
+ ///
+ /// A shared used from to create messages.
+ ///
+ private static StringBuilder? infoQueueMessageBuilder;
+
///
/// Flushes all the pending debug messages for all existing instances to the console/debugger.
/// It also checks whether or not there are any error messages being logged that didn't result in an actual crash yet.
@@ -27,7 +32,7 @@ internal static partial class DeviceHelper
lock (DevicesCache)
{
- StringBuilder builder = new(1024);
+ StringBuilder builder = infoQueueMessageBuilder ??= new(1024);
foreach (var pair in D3D12InfoQueueMap)
{