summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorXiaohong Bao <bao@lindenlab.com>2011-01-24 15:50:46 -0700
committerXiaohong Bao <bao@lindenlab.com>2011-01-24 15:50:46 -0700
commit2a14079563ce323452a8088cca994e4f5c0edcd4 (patch)
treeffadec0c7ad3f0574e1e67a3bd796e8aaad6cd66 /indra/newview
parent130e6e895b1707445b8d297dadad13e678848dd6 (diff)
fix for SH-445: debug settings -> "CacheNumberOfRegionsForObjects" does not limit the number of object cache files
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/app_settings/settings.xml2
-rw-r--r--indra/newview/llvocache.cpp20
-rw-r--r--indra/newview/llvocache.h2
3 files changed, 15 insertions, 9 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 819808ec40..ced46c7294 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -1179,7 +1179,7 @@
<key>Type</key>
<string>U32</string>
<key>Value</key>
- <integer>20000</integer>
+ <integer>128</integer>
</map>
<key>CacheSize</key>
<map>
diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp
index 1e2736f7d9..b3312db4a0 100644
--- a/indra/newview/llvocache.cpp
+++ b/indra/newview/llvocache.cpp
@@ -517,6 +517,11 @@ void LLVOCache::readCacheHeader()
{
removeCache() ; //failed to read header, clear the cache
}
+ else if(mNumEntries >= mCacheSize)
+ {
+ purgeEntries(mCacheSize) ;
+ }
+
return ;
}
@@ -644,9 +649,9 @@ void LLVOCache::readFromCache(U64 handle, const LLUUID& id, LLVOCacheEntry::voca
return ;
}
-void LLVOCache::purgeEntries()
+void LLVOCache::purgeEntries(U32 size)
{
- while(mHeaderEntryQueue.size() >= mCacheSize)
+ while(mHeaderEntryQueue.size() >= size)
{
header_entry_queue_t::iterator iter = mHeaderEntryQueue.begin() ;
HeaderEntryInfo* entry = *iter ;
@@ -671,16 +676,17 @@ void LLVOCache::writeToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry:
{
llwarns << "Not writing cache for handle " << handle << "): Cache is currently in read-only mode." << llendl;
return ;
- }
- if(mNumEntries >= mCacheSize)
- {
- purgeEntries() ;
- }
+ }
HeaderEntryInfo* entry;
handle_entry_map_t::iterator iter = mHandleEntryMap.find(handle) ;
if(iter == mHandleEntryMap.end()) //new entry
{
+ if(mNumEntries >= mCacheSize - 1)
+ {
+ purgeEntries(mCacheSize - 1) ;
+ }
+
entry = new HeaderEntryInfo();
entry->mHandle = handle ;
entry->mTime = time(NULL) ;
diff --git a/indra/newview/llvocache.h b/indra/newview/llvocache.h
index 1070fcaae9..14e3b4c793 100644
--- a/indra/newview/llvocache.h
+++ b/indra/newview/llvocache.h
@@ -130,7 +130,7 @@ private:
void clearCacheInMemory();
void removeCache() ;
void removeEntry(HeaderEntryInfo* entry) ;
- void purgeEntries();
+ void purgeEntries(U32 size);
BOOL updateEntry(const HeaderEntryInfo* entry);
private: