From 005da00fff65e48c47801982cb3ff2ff45ee8985 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 11 Mar 2011 14:38:09 -0800 Subject: STORM-1059 : Fix for cache purging (fix by Aleric) --- indra/newview/lltexturecache.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'indra/newview/lltexturecache.cpp') diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp index f54214b95c..7fb52c1939 100644 --- a/indra/newview/lltexturecache.cpp +++ b/indra/newview/lltexturecache.cpp @@ -1419,22 +1419,21 @@ void LLTextureCache::readHeaderCache() } } } - if (num_entries > sCacheMaxEntries) + if (num_entries - empty_entries > sCacheMaxEntries) { // Special case: cache size was reduced, need to remove entries // Note: After we prune entries, we will call this again and create the LRU - U32 entries_to_purge = (num_entries-empty_entries) - sCacheMaxEntries; + U32 entries_to_purge = (num_entries - empty_entries) - sCacheMaxEntries; llinfos << "Texture Cache Entries: " << num_entries << " Max: " << sCacheMaxEntries << " Empty: " << empty_entries << " Purging: " << entries_to_purge << llendl; - if (entries_to_purge > 0) + // We can exit the following loop with the given condition, since if we'd reach the end of the lru set we'd have: + // purge_list.size() = lru.size() = num_entries - empty_entries = entries_to_purge + sCacheMaxEntries >= entries_to_purge + // So, it's certain that iter will never reach lru.end() first. + std::set::iterator iter = lru.begin(); + while (purge_list.size() < entries_to_purge) { - for (std::set::iterator iter = lru.begin(); iter != lru.end(); ++iter) - { - purge_list.insert(iter->second); - if (purge_list.size() >= entries_to_purge) - break; - } + purge_list.insert(iter->second); + ++iter; } - llassert_always(purge_list.size() >= entries_to_purge); } else { -- cgit v1.2.3 From 5c7a906b44aa950ec3c8b786fec6516b51f9d66c Mon Sep 17 00:00:00 2001 From: Logan Dethrow Date: Fri, 6 May 2011 15:15:17 -0400 Subject: Increased the viewer cache size limit to 10GB. Increased the default to 1GB. * Changed the hard coded cache limit in llappviewer.cpp to 10GB as well as the slider maximum in the preferences menu. * The VFS cache is capped at 1GB due to file system limitations. The former 80/20 split between texture/vfs is maintained up to 5GB. Above this limit the texture cache is given all the additional cache space up to 10GB. * Fixed a log message in lltexturecache.cpp that was not showing the correct texture size. ER-883 * Fixed a bug in llfloaterpreference.cpp that caused new cache value to be written to the old cache setting. This resulted in the the cache not being cleared when the location was set back to the default. ER-882 * Disabled the "The cache will be cleared on reboot" message that is triggered by the reset button in the cache preferences in the case where the cache is already located in the default location. The cache is only cleared when its location is changed. This is intended to address resident confusion regarding the purpose of the reset button, as demonstrated in VWR-19562. --- indra/newview/lltexturecache.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/lltexturecache.cpp') diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp index 7fb52c1939..5a68e0e37e 100644 --- a/indra/newview/lltexturecache.cpp +++ b/indra/newview/lltexturecache.cpp @@ -949,7 +949,7 @@ S64 LLTextureCache::initCache(ELLPath location, S64 max_size, BOOL texture_cache max_size -= sCacheMaxTexturesSize; LL_INFOS("TextureCache") << "Headers: " << sCacheMaxEntries - << " Textures size: " << sCacheMaxTexturesSize/(1024*1024) << " MB" << LL_ENDL; + << " Textures size: " << sCacheMaxTexturesSize / (1024 * 1024) << " MB" << LL_ENDL; setDirNames(location); @@ -1655,7 +1655,7 @@ void LLTextureCache::purgeTextures(bool validate) LL_INFOS("TextureCache") << "TEXTURE CACHE:" << " PURGED: " << purge_count << " ENTRIES: " << num_entries - << " CACHE SIZE: " << mTexturesSizeTotal / 1024*1024 << " MB" + << " CACHE SIZE: " << mTexturesSizeTotal / (1024 * 1024) << " MB" << llendl; } -- cgit v1.2.3 From 57bdcd6bda363fc8df21563597419f12c87f7b15 Mon Sep 17 00:00:00 2001 From: Logan Dethrow Date: Wed, 25 May 2011 15:44:03 -0400 Subject: VWR-25862 Potential fix for caches not clearing when they are supposed to. * Removed leading delimiter from filename mask in all calls to LLDir::deleteFilesInDir() that are related to the viewer asset caches (texture, VFS, and VO). --- indra/newview/lltexturecache.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/lltexturecache.cpp') diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp index 7fb52c1939..faab6ac002 100644 --- a/indra/newview/lltexturecache.cpp +++ b/indra/newview/lltexturecache.cpp @@ -1513,12 +1513,12 @@ void LLTextureCache::purgeAllTextures(bool purge_directories) { const char* subdirs = "0123456789abcdef"; std::string delem = gDirUtilp->getDirDelimiter(); - std::string mask = delem + "*"; + std::string mask = "*"; for (S32 i=0; i<16; i++) { std::string dirname = mTexturesDirName + delem + subdirs[i]; llinfos << "Deleting files in directory: " << dirname << llendl; - gDirUtilp->deleteFilesInDir(dirname,mask); + gDirUtilp->deleteFilesInDir(dirname, mask); if (purge_directories) { LLFile::rmdir(dirname); -- cgit v1.2.3