allocate llRAW LookupHeightTable on demand and release it, saving a few 512KB of memory

This commit is contained in:
UbitUmarov
2015-09-07 08:06:41 +01:00
parent 3a8e76cdd1
commit abd6640453

View File

@@ -56,6 +56,10 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
HeightmapLookupValue[] LookupHeightTable;
public LLRAW()
{
}
private void BuildLookupHeightTable()
{
LookupHeightTable = new HeightmapLookupValue[256 * 256];
@@ -186,6 +190,9 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
public void SaveStream(Stream s, ITerrainChannel map)
{
if (LookupHeightTable == null)
BuildLookupHeightTable();
using (BinaryWriter binStream = new BinaryWriter(s))
{
// Output the calculated raw
@@ -241,6 +248,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
}
}
}
LookupHeightTable = null;
}
public string FileExtension