Fix a problem in the Flotsam asset cache where assets were being put into the memory cache even when it wasn't enabled.

This hopefully addresses http://opensimulator.org/mantis/view.php?id=5634
This is the most probable cause of the memory problems that people have been seeing in the past month.
This bug has been around since commit 5dc785b (4th July 2011).  Doh!  This is why regressions tests are such a good idea... :)
Many thanks to Nebadon for using git bisect to track down this bug, which made it a 5 minute fix.
bulletsim
Justin Clark-Casey (justincc) 2011-08-13 15:16:43 +01:00
parent 77625dae36
commit dcb4b2de09
1 changed files with 6 additions and 2 deletions

View File

@ -357,8 +357,6 @@ namespace Flotsam.RegionModules.AssetCache
asset = (AssetBase)bformatter.Deserialize(stream);
UpdateMemoryCache(id, asset);
m_DiskHits++;
}
catch (System.Runtime.Serialization.SerializationException e)
@ -419,9 +417,15 @@ namespace Flotsam.RegionModules.AssetCache
if (m_MemoryCacheEnabled)
asset = GetFromMemoryCache(id);
if (asset == null && m_FileCacheEnabled)
{
asset = GetFromFileCache(id);
if (m_MemoryCacheEnabled && asset != null)
UpdateMemoryCache(id, asset);
}
if (((m_LogLevel >= 1)) && (m_HitRateDisplay != 0) && (m_Requests % m_HitRateDisplay == 0))
{
m_HitRateFile = (double)m_DiskHits / m_Requests * 100.0;