diff options
author | Xiaohong Bao <bao@lindenlab.com> | 2011-01-24 15:50:46 -0700 |
---|---|---|
committer | Xiaohong Bao <bao@lindenlab.com> | 2011-01-24 15:50:46 -0700 |
commit | 2a14079563ce323452a8088cca994e4f5c0edcd4 (patch) | |
tree | ffadec0c7ad3f0574e1e67a3bd796e8aaad6cd66 /indra/newview/llvocache.cpp | |
parent | 130e6e895b1707445b8d297dadad13e678848dd6 (diff) |
fix for SH-445: debug settings -> "CacheNumberOfRegionsForObjects" does not limit the number of object cache files
Diffstat (limited to 'indra/newview/llvocache.cpp')
-rw-r--r-- | indra/newview/llvocache.cpp | 20 |
1 files changed, 13 insertions, 7 deletions
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) ; |