summaryrefslogtreecommitdiff
path: root/indra/llcommon/llmemory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llcommon/llmemory.cpp')
-rw-r--r--indra/llcommon/llmemory.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/indra/llcommon/llmemory.cpp b/indra/llcommon/llmemory.cpp
index 629e76f341..ed28974163 100644
--- a/indra/llcommon/llmemory.cpp
+++ b/indra/llcommon/llmemory.cpp
@@ -61,6 +61,10 @@ BOOL LLMemory::sEnableMemoryFailurePrevention = FALSE;
LLPrivateMemoryPoolManager::mem_allocation_info_t LLPrivateMemoryPoolManager::sMemAllocationTracker;
#endif
+#ifndef _USE_PRIVATE_MEM_POOL_
+#define _USE_PRIVATE_MEM_POOL_ 0
+#endif
+
//static
void LLMemory::initClass()
{
@@ -224,11 +228,6 @@ void* ll_allocate (size_t size)
return p;
}
-void ll_release (void *p)
-{
- free(p);
-}
-
//----------------------------------------------------------------------------
#if defined(LL_WINDOWS)
@@ -415,7 +414,7 @@ LLMemTracker::LLMemTracker()
mDrawnIndex = 0 ;
mPaused = FALSE ;
- mMutexp = new LLMutex(NULL) ;
+ mMutexp = new LLMutex() ;
mStringBuffer = new char*[128] ;
mStringBuffer[0] = new char[mCapacity * 128] ;
for(S32 i = 1 ; i < mCapacity ; i++)
@@ -1899,6 +1898,7 @@ char* LLPrivateMemoryPoolManager::allocate(LLPrivateMemoryPool* poolp, U32 size,
//static
char* LLPrivateMemoryPoolManager::allocate(LLPrivateMemoryPool* poolp, U32 size)
{
+#if _USE_PRIVATE_MEM_POOL_
if(!poolp)
{
return new char[size] ;
@@ -1907,6 +1907,9 @@ char* LLPrivateMemoryPoolManager::allocate(LLPrivateMemoryPool* poolp, U32 size)
{
return poolp->allocate(size) ;
}
+#else
+ return (char*)malloc(size) ;
+#endif
}
#endif
@@ -1922,6 +1925,7 @@ void LLPrivateMemoryPoolManager::freeMem(LLPrivateMemoryPool* poolp, void* addr
sMemAllocationTracker.erase((char*)addr) ;
#endif
+#if _USE_PRIVATE_MEM_POOL_
if(poolp)
{
poolp->freeMem(addr) ;
@@ -1930,6 +1934,9 @@ void LLPrivateMemoryPoolManager::freeMem(LLPrivateMemoryPool* poolp, void* addr
{
delete[] (char*)addr ;
}
+#else
+ free(addr) ;
+#endif
}
//--------------------------------------------------------------------