summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorDon Kjer <don@lindenlab.com>2010-12-15 15:56:44 -0800
committerDon Kjer <don@lindenlab.com>2010-12-15 15:56:44 -0800
commit3b683f27b2a0bc7e69effac1ce31a121b787f46e (patch)
tree8f50a8267812d1e6f996fde314fb70fc56384710 /indra/newview
parentb0ee1c818aa779edbb57f70b723132ce8d7347f7 (diff)
parent2192316803564b41a28d56481985597eb5d94fad (diff)
Merged viewer-sandbox
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llvocache.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp
index 6ea88abab8..10744991f4 100644
--- a/indra/newview/llvocache.cpp
+++ b/indra/newview/llvocache.cpp
@@ -225,7 +225,8 @@ BOOL LLVOCacheEntry::writeToFile(LLAPRFile* apr_file) const
// Format string used to construct filename for the object cache
static const char OBJECT_CACHE_FILENAME[] = "objects_%d_%d.slc";
-const U32 NUM_ENTRIES_TO_PURGE = 50;
+// Throw out 1/20 (5%) of our cache entries if we run out of room.
+const U32 ENTRIES_PURGE_FACTOR = 20;
const char* object_cache_dirname = "objectcache";
const char* header_filename = "object.cache";
@@ -592,7 +593,8 @@ void LLVOCache::readFromCache(U64 handle, const LLUUID& id, LLVOCacheEntry::voca
void LLVOCache::purgeEntries()
{
- U32 limit = mCacheSize - NUM_ENTRIES_TO_PURGE ;
+ U32 limit = mCacheSize / ENTRIES_PURGE_FACTOR;
+ limit = llclamp(limit, 1, mCacheSize);
// Construct a vector of entries out of the map so we can sort by time.
std::vector<HeaderEntryInfo*> header_vector;
handle_entry_map_t::iterator iter_end = mHandleEntryMap.end();