diff --git a/src/ImageSharp/Formats/Jpeg/JpegEncoderCore.cs b/src/ImageSharp/Formats/Jpeg/JpegEncoderCore.cs
index d9d42e061..abe59516f 100644
--- a/src/ImageSharp/Formats/Jpeg/JpegEncoderCore.cs
+++ b/src/ImageSharp/Formats/Jpeg/JpegEncoderCore.cs
@@ -288,8 +288,10 @@ namespace SixLabors.ImageSharp.Formats.Jpeg
/// The number of components to write.
private void WriteDefineHuffmanTables(int componentCount)
{
+ // This uses a C#'s compiler optimization that refers to the static data segment of the assembly,
+ // and doesn't incur any allocation at all.
// Table identifiers.
- ReadOnlySpan headers = stackalloc byte[]
+ ReadOnlySpan headers = new byte[]
{
0x00,
0x10,