diff --git a/OpenRA.Game/Graphics/Sheet.cs b/OpenRA.Game/Graphics/Sheet.cs index 5812eb41ec..9e594decb6 100644 --- a/OpenRA.Game/Graphics/Sheet.cs +++ b/OpenRA.Game/Graphics/Sheet.cs @@ -153,6 +153,10 @@ namespace OpenRA.Graphics return; dirty = true; releaseBufferOnCommit = true; + + // Commit data from the buffer to the texture, allowing the buffer to be released and reclaimed by GC. + if (Game.Renderer != null) + GetTexture(); } public void Dispose() diff --git a/OpenRA.Game/Map/MapCache.cs b/OpenRA.Game/Map/MapCache.cs index 1bf040f7fc..8c5e18d22f 100644 --- a/OpenRA.Game/Map/MapCache.cs +++ b/OpenRA.Game/Map/MapCache.cs @@ -276,13 +276,8 @@ namespace OpenRA } } - // The buffer is not fully reclaimed until changes are written out to the texture. - // We will access the texture in order to force changes to be written out, allowing the buffer to be freed. - Game.RunAfterTick(() => - { - sheetBuilder.Current.ReleaseBuffer(); - sheetBuilder.Current.GetTexture(); - }); + // Release the buffer by forcing changes to be written out to the texture, allowing the buffer to be reclaimed by GC. + Game.RunAfterTick(sheetBuilder.Current.ReleaseBuffer); Log.Write("debug", "MapCache.LoadAsyncInternal ended"); }