I've created ILockBytesOnHGlobal and I write 64k of data repeatedly. What I've noticed is that WriteAt performance decreases over the time.
What could be the reason for the performance slow down? Does it have to do with stream growth? Here is what I'm doing (in C#)
public override void Write(byte[] buffer, int offset, int count)
{
EnsureBufferSize(count);
Marshal.Copy(buffer, offset, hGlobalBuffer, count);
lockBytes.WriteAt(writeOffset, hGlobalBuffer, count, out temp);
writeOffset += temp.ToUInt32();
}