diff --git a/indra/llcommon/llthread.cpp b/indra/llcommon/llthread.cpp index 8ae458c1c..85d88f01d 100644 --- a/indra/llcommon/llthread.cpp +++ b/indra/llcommon/llthread.cpp @@ -67,6 +67,7 @@ U32 ll_thread_local local_thread_ID = 0; #endif U32 LLThread::sIDIter = 0; +LLAtomicS32 LLThread::sCount = 0; LL_COMMON_API void assert_main_thread() { @@ -125,6 +126,8 @@ LLThread::LLThread(std::string const& name) : mThreadLocalData(NULL) { mID = ++sIDIter; + sCount++; + llassert(sCount <= 50); mRunCondition = new LLCondition; } @@ -175,7 +178,7 @@ void LLThread::shutdown() } mAPRThreadp = NULL; } - + sCount--; delete mRunCondition; mRunCondition = 0; } diff --git a/indra/llcommon/llthread.h b/indra/llcommon/llthread.h index f0e4f39f5..9ab7829c6 100644 --- a/indra/llcommon/llthread.h +++ b/indra/llcommon/llthread.h @@ -73,6 +73,7 @@ class LL_COMMON_API LLThread { private: static U32 sIDIter; + static LLAtomicS32 sCount; public: typedef enum e_thread_status @@ -90,6 +91,7 @@ public: bool isStopped() const { return (STOPPED == mStatus); } static U32 currentID(); // Return ID of current thread + static S32 getCount() { return sCount; } static void yield(); // Static because it can be called by the main thread, which doesn't have an LLThread data structure. public: @@ -129,7 +131,7 @@ protected: apr_thread_t *mAPRThreadp; volatile EThreadStatus mStatus; U32 mID; - + friend void LLThreadLocalData::create(LLThread* threadp); LLThreadLocalData* mThreadLocalData; diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index ecd22b0ae..f9b809665 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -8156,7 +8156,7 @@ Type F32 Value - 600.0 + 30.0 MemoryPrivatePoolEnabled diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index a78f98f2d..949235013 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -228,6 +228,7 @@ void display_stats() gMemoryAllocated = LLMemory::getCurrentRSS(); U32 memory = (U32)(gMemoryAllocated / (1024*1024)); llinfos << llformat("MEMORY: %d MB", memory) << llendl; + llinfos << "THREADS: "<< LLThread::getCount() << llendl; LLMemory::logMemoryInfo(TRUE) ; gRecentMemoryTime.reset(); }