diff options
Diffstat (limited to 'indra/llcommon')
-rw-r--r-- | indra/llcommon/llmemory.cpp | 22 | ||||
-rw-r--r-- | indra/llcommon/llmemory.h | 8 |
2 files changed, 18 insertions, 12 deletions
diff --git a/indra/llcommon/llmemory.cpp b/indra/llcommon/llmemory.cpp index 4db1b8bd10..bb7998c0a8 100644 --- a/indra/llcommon/llmemory.cpp +++ b/indra/llcommon/llmemory.cpp @@ -1821,6 +1821,7 @@ void LLPrivateMemoryPool::LLChunkHashElement::remove(LLPrivateMemoryPool::LLMemo //class LLPrivateMemoryPoolManager //-------------------------------------------------------------------- LLPrivateMemoryPoolManager* LLPrivateMemoryPoolManager::sInstance = NULL ; +BOOL LLPrivateMemoryPoolManager::sPrivatePoolEnabled = FALSE ; std::vector<LLPrivateMemoryPool*> LLPrivateMemoryPoolManager::sDanglingPoolList ; LLPrivateMemoryPoolManager::LLPrivateMemoryPoolManager(BOOL enabled, U32 max_pool_size) @@ -1832,7 +1833,7 @@ LLPrivateMemoryPoolManager::LLPrivateMemoryPoolManager(BOOL enabled, U32 max_poo mPoolList[i] = NULL ; } - mPrivatePoolEnabled = enabled ; + sPrivatePoolEnabled = enabled ; const U32 MAX_POOL_SIZE = 256 * 1024 * 1024 ; //256 MB mMaxPrivatePoolSize = llmax(max_pool_size, MAX_POOL_SIZE) ; @@ -1917,7 +1918,7 @@ void LLPrivateMemoryPoolManager::destroyClass() LLPrivateMemoryPool* LLPrivateMemoryPoolManager::newPool(S32 type) { - if(!mPrivatePoolEnabled) + if(!sPrivatePoolEnabled) { return NULL ; } @@ -2015,7 +2016,11 @@ void LLPrivateMemoryPoolManager::freeMem(LLPrivateMemoryPool* poolp, void* addr } else { - if(!sInstance) //the private memory manager is destroyed, try the dangling list + if(!sPrivatePoolEnabled) + { + free(addr) ; //private pool is disabled. + } + else if(!sInstance) //the private memory manager is destroyed, try the dangling list { for(S32 i = 0 ; i < sDanglingPoolList.size(); i++) { @@ -2036,12 +2041,13 @@ void LLPrivateMemoryPoolManager::freeMem(LLPrivateMemoryPool* poolp, void* addr addr = NULL ; break ; } - } + } + llassert_always(!addr) ; //addr should be release before hitting here! + } + else + { + llerrs << "private pool is used before initialized.!" << llendl ; } - - llassert_always(!addr) ; //addr should be release before hitting here! - - free(addr) ; } } diff --git a/indra/llcommon/llmemory.h b/indra/llcommon/llmemory.h index 74cf42c894..bbbdaa6497 100644 --- a/indra/llcommon/llmemory.h +++ b/indra/llcommon/llmemory.h @@ -394,12 +394,12 @@ public: LLPrivateMemoryPool* newPool(S32 type) ; void deletePool(LLPrivateMemoryPool* pool) ; -private: - static LLPrivateMemoryPoolManager* sInstance ; - std::vector<LLPrivateMemoryPool*> mPoolList ; - BOOL mPrivatePoolEnabled; +private: + std::vector<LLPrivateMemoryPool*> mPoolList ; U32 mMaxPrivatePoolSize; + static LLPrivateMemoryPoolManager* sInstance ; + static BOOL sPrivatePoolEnabled; static std::vector<LLPrivateMemoryPool*> sDanglingPoolList ; public: //debug and statistics info. |