summaryrefslogtreecommitdiff
path: root/indra/llcommon/llmemory.cpp
diff options
context:
space:
mode:
authorXiaohong Bao <bao@lindenlab.com>2011-10-25 22:53:40 -0600
committerXiaohong Bao <bao@lindenlab.com>2011-10-25 22:53:40 -0600
commit0637fe27bc9f07208a1703349a304b27fc08a535 (patch)
treeab32091bbca0fe17eed12e50022aad805ba8c371 /indra/llcommon/llmemory.cpp
parent67c77496248c13a9770df6823e49d6fba522df7e (diff)
fix for SH-2624: crash at LLPrivateMemoryPoolManager::freeMem: ASSERT (!addr)
Diffstat (limited to 'indra/llcommon/llmemory.cpp')
-rw-r--r--indra/llcommon/llmemory.cpp22
1 files changed, 14 insertions, 8 deletions
diff --git a/indra/llcommon/llmemory.cpp b/indra/llcommon/llmemory.cpp
index 7d340483b7..7167d705af 100644
--- a/indra/llcommon/llmemory.cpp
+++ b/indra/llcommon/llmemory.cpp
@@ -1773,6 +1773,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)
@@ -1784,7 +1785,7 @@ LLPrivateMemoryPoolManager::LLPrivateMemoryPoolManager(BOOL enabled)
mPoolList[i] = NULL ;
}
- mPrivatePoolEnabled = enabled ;
+ sPrivatePoolEnabled = enabled ;
}
LLPrivateMemoryPoolManager::~LLPrivateMemoryPoolManager()
@@ -1866,7 +1867,7 @@ void LLPrivateMemoryPoolManager::destroyClass()
LLPrivateMemoryPool* LLPrivateMemoryPoolManager::newPool(S32 type)
{
- if(!mPrivatePoolEnabled)
+ if(!sPrivatePoolEnabled)
{
return NULL ;
}
@@ -1964,7 +1965,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++)
{
@@ -1985,12 +1990,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) ;
}
}