diff options
author | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2011-10-31 11:35:22 -0400 |
---|---|---|
committer | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2011-10-31 11:35:22 -0400 |
commit | 51c7887f8d8ad0b22c8452f002d74afcc8fbea71 (patch) | |
tree | decec7dc66cfe3ccf0d6b1498a7220530743ad4b /indra/llcommon/llmemory.cpp | |
parent | f18cfe97750cc13374adab15636532fe0fbda19c (diff) | |
parent | db363104dc4055b7ed15d695b23df99bb33eb1c8 (diff) |
merge
Diffstat (limited to 'indra/llcommon/llmemory.cpp')
-rw-r--r-- | indra/llcommon/llmemory.cpp | 22 |
1 files changed, 14 insertions, 8 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) ; } } |