allocate llRAW LookupHeightTable on demand and release it, saving a few 512KB of memory
parent
3a8e76cdd1
commit
abd6640453
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue