private unsafe void InitializeHeader(int physicalBufferListSize)
        {
            int    headerSize = HeaderBufferListOffset + IntPtr.Size * physicalBufferListSize;
            IntPtr header     = MemoryHelpers.AllocateMemory(headerSize);
            IntPtr oldHeader  = IntPtr.Zero;

            MemoryHelpers.Memset(header, headerSize, 0);

            // check if an older header exists and copy all data from it to the newly
            // allocated header.
            if (_serializedDataHeaderSize > 0)
            {
                Debug.Assert(headerSize > _serializedDataHeaderSize);

                Buffer.MemoryCopy((byte *)DBGVISIBLE_serializedDataHeader, (byte *)header, headerSize, _serializedDataHeaderSize);

                // mark the older header for deletion
                oldHeader = DBGVISIBLE_serializedDataHeader;
            }
            else
            {
                // write the serialization format version
                *(int *)header = SerializationFormatVersion;
                // write the total allocated number of physical buffers (0)
                *(int *)(header + sizeof(int)) = 0;
                Debug.Assert(_activePhysicalBufferIdx == 0);
            }

            DBGVISIBLE_serializedDataHeader = header;
            _serializedDataHeaderSize       = headerSize;

            // delete the older header if a new one was allocated
            if (oldHeader != IntPtr.Zero)
            {
                MemoryHelpers.FreeMemory(oldHeader);
            }
        }