diff --git a/indra/llcommon/llmemory.cpp b/indra/llcommon/llmemory.cpp
index d6ae1284d3..9bade9ea69 100644
--- a/indra/llcommon/llmemory.cpp
+++ b/indra/llcommon/llmemory.cpp
@@ -225,38 +225,72 @@ U64 LLMemory::getCurrentRSS()
}
#elif defined(LL_LINUX)
+// Linux RSS appears to have drifted from the implementation below.
+// U64 LLMemory::getCurrentRSS()
+// {
+// static const char statPath[] = "/proc/self/stat";
+// LLFILE *fp = LLFile::fopen(statPath, "r");
+// U64 rss = 0;
-U64 LLMemory::getCurrentRSS()
-{
- static const char statPath[] = "/proc/self/stat";
- LLFILE *fp = LLFile::fopen(statPath, "r");
- U64 rss = 0;
+// if (fp == NULL)
+// {
+// LL_WARNS() << "couldn't open " << statPath << LL_ENDL;
+// return 0;
+// }
- if (fp == NULL)
- {
- LL_WARNS() << "couldn't open " << statPath << LL_ENDL;
- return 0;
- }
-
- // Eee-yew! See Documentation/filesystems/proc.txt in your
- // nearest friendly kernel tree for details.
+// // Eee-yew! See Documentation/filesystems/proc.txt in your
+// // nearest friendly kernel tree for details.
- {
- int ret = fscanf(fp, "%*d (%*[^)]) %*c %*d %*d %*d %*d %*d %*d %*d "
- "%*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %Lu",
- &rss);
- if (ret != 1)
- {
- LL_WARNS() << "couldn't parse contents of " << statPath << LL_ENDL;
- rss = 0;
- }
- }
+// {
+// int ret = fscanf(fp, "%*d (%*[^)]) %*c %*d %*d %*d %*d %*d %*d %*d "
+// "%*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %Lu",
+// &rss);
+// if (ret != 1)
+// {
+// LL_WARNS() << "couldn't parse contents of " << statPath << LL_ENDL;
+// rss = 0;
+// }
+// }
- fclose(fp);
+// fclose(fp);
- return rss;
+// return rss;
+// }
+#include
+#include
+#include
+#include
+#include
+#include
+
+// return the RSS in bytes. This value is converted to kilobytes implicitly elsewhere.
+U64 LLMemory::getCurrentRSS() {
+ namespace fs = std::filesystem;
+
+ // Get the page size (static variable)
+ static const long pageSize = sysconf(_SC_PAGESIZE);
+
+ // Open the /proc/self/statm file
+ static const auto statmPath = fs::path("/proc/self/statm");
+ std::ifstream statmFile(statmPath);
+ if (!statmFile.is_open()) {
+ return 0; // Return 0 if the file cannot be opened
+ }
+
+ // Read the entire line from statm file
+ std::string line;
+ std::getline(statmFile, line);
+ statmFile.close();
+
+ // Extract the values from the line
+ std::istringstream iss(line);
+ long size, rss, shared, text, lib, data, dt;
+ iss >> size >> rss >> shared >> text >> lib >> data >> dt;
+
+ // Convert pages to bytes and return RSS
+ return static_cast( rss * pageSize );
}
-
+//
#else
U64 LLMemory::getCurrentRSS()
diff --git a/indra/llcommon/llthreadsafequeue.h b/indra/llcommon/llthreadsafequeue.h
index 48b50a2cea..082337cf3e 100644
--- a/indra/llcommon/llthreadsafequeue.h
+++ b/indra/llcommon/llthreadsafequeue.h
@@ -311,7 +311,7 @@ bool LLThreadSafeQueue::push_(lock_t& lock, T&& element)
// Make thread queue capacity hangs visible
// return false;
{
- LL_WARNS("ThreadPool") << "Threadsafe queue push_(lockacquired) queue full " << mStorage.size() << " >= " << mCapacity << LL_ENDL;
+ LL_WARNS_ONCE("ThreadPool") << "Threadsafe queue push_(lockacquired) queue full " << mStorage.size() << " >= " << mCapacity << LL_ENDL;
return false;
}
//
diff --git a/indra/llinventory/llpermissions.cpp b/indra/llinventory/llpermissions.cpp
index fd9997b885..d3b5734616 100644
--- a/indra/llinventory/llpermissions.cpp
+++ b/indra/llinventory/llpermissions.cpp
@@ -947,7 +947,7 @@ std::ostream& operator<<(std::ostream &s, const LLAggregatePermissions &perm)
}
// This converts a permissions mask into a string for debugging use.
-void mask_to_string(U32 mask, char* str)
+void mask_to_string(U32 mask, char* str, bool isOpenSim /*=false*/) // remove misleading X for export when not in OpenSim
{
if (mask & PERM_MOVE)
{
@@ -990,23 +990,29 @@ void mask_to_string(U32 mask, char* str)
str++;
// OpenSim export permission
- if (mask & PERM_EXPORT)
+#ifdef OPENSIM
+ // The export permission is only available in OpenSim.
+ if (isOpenSim)
{
- *str = 'X';
+ if (mask & PERM_EXPORT)
+ {
+ *str = 'X';
+ }
+ else
+ {
+ *str = ' ';
+ }
+ str++;
}
- else
- {
- *str = ' ';
- }
- str++;
+#endif
//
*str = '\0';
}
-std::string mask_to_string(U32 mask)
+std::string mask_to_string(U32 mask, bool isOpenSim /*=false*/) // remove misleading X for export when not in OpenSim
{
char str[16];
- mask_to_string(mask, str);
+ mask_to_string(mask, str, isOpenSim); // remove misleading X for export when not in OpenSim
return std::string(str);
}
diff --git a/indra/llinventory/llpermissions.h b/indra/llinventory/llpermissions.h
index 8646224b7e..bcf03b8e41 100644
--- a/indra/llinventory/llpermissions.h
+++ b/indra/llinventory/llpermissions.h
@@ -35,8 +35,8 @@
// prototypes
class LLMessageSystem;
-extern void mask_to_string(U32 mask, char* str);
-extern std::string mask_to_string(U32 mask);
+extern void mask_to_string(U32 mask, char* str, bool isOpenSim=false);
+extern std::string mask_to_string(U32 mask, bool isOpenSim=false);
template class LLMetaClassT;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 56d1b498e3..b03eb1dc9c 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -9948,7 +9948,7 @@
Type
U32
Value
- 64
+ 0
NoPreload
SceneLoadLowMemoryBound
SceneLoadMinRadius