Create a separate FrameCache for caching sprite frames.
We split the caching SpriteLoader into a SpriteCache and FrameCache. SpriteLoader instead becomes a holder for static loading methods. Only a few classes loaded sprite frames, and they all use it with a transient cache. By moving this method into a new class, we can lose the now redundant frame cache, saving on memory significantly since the frame data array can be reclaimed by the GC. This saves ~58 MiB on frames and ~4 MiB on the caching dictionary in simple tests.
This commit is contained in:
@@ -41,8 +41,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
|
||||
var palette = new ImmutablePalette(args[2], shadowIndex);
|
||||
|
||||
var frames = new SpriteLoader(modData.SpriteLoaders, new string[0], null)
|
||||
.LoadAllFrames(src);
|
||||
var frames = SpriteLoader.GetFrames(src, new string[0], modData.SpriteLoaders);
|
||||
|
||||
var usePadding = !args.Contains("--nopadding");
|
||||
var count = 0;
|
||||
|
||||
Reference in New Issue
Block a user