Horde: Reduce peak memory usage when building workspace snapshots. Was previously keeping references to Memory<byte> ranges within a much larger buffer, preventing them from being GC'd.

[CL 16867148 by Ben Marsh in ue5-main branch]
This commit is contained in:
Ben Marsh
2021-07-15 16:56:05 -04:00
parent 99d43a4244
commit 3e931e256f
2 changed files with 19 additions and 5 deletions
@@ -86,6 +86,17 @@ namespace EpicGames.Core
this.Memory = new ReadOnlyMemory<byte>(Buffer, Offset, Length);
}
/// <summary>
/// Duplicate this string
/// </summary>
/// <returns></returns>
public Utf8String Clone()
{
byte[] NewBuffer = new byte[Memory.Length];
Memory.CopyTo(NewBuffer);
return new Utf8String(NewBuffer);
}
/// <summary>
/// Tests two strings for equality
/// </summary>