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 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) ;  	}	  } diff --git a/indra/llcommon/llmemory.h b/indra/llcommon/llmemory.h index 25e6c68e88..7646bcfc25 100644 --- a/indra/llcommon/llmemory.h +++ b/indra/llcommon/llmemory.h @@ -394,11 +394,11 @@ public:  	LLPrivateMemoryPool* newPool(S32 type) ;  	void deletePool(LLPrivateMemoryPool* pool) ; -private: -	static LLPrivateMemoryPoolManager* sInstance ; -	std::vector<LLPrivateMemoryPool*> mPoolList ; -	BOOL mPrivatePoolEnabled; +private:	 +	std::vector<LLPrivateMemoryPool*> mPoolList ;	 +	static LLPrivateMemoryPoolManager* sInstance ; +	static BOOL sPrivatePoolEnabled;  	static std::vector<LLPrivateMemoryPool*> sDanglingPoolList ;  public:  	//debug and statistics info. | 
