Trim memory usage of FileSystem.

When LoadFromManifest is called, trim the various backing collections. These backing collections tend to live a long time without further modifications.
This commit is contained in:
RoosterDragon
2024-04-01 14:38:41 +01:00
committed by Gustas
parent c547f3f26d
commit 2481bddf58

View File

@@ -186,6 +186,12 @@ namespace OpenRA.FileSystem
UnmountAll();
foreach (var kv in manifest.Packages)
Mount(kv.Key, kv.Value);
mountedPackages.TrimExcess();
explicitMounts.TrimExcess();
modPackages.TrimExcess();
foreach (var packages in fileIndex.Values)
packages.TrimExcess();
}
Stream GetFromCache(string filename)