diff options
Diffstat (limited to 'indra/llcommon')
-rw-r--r-- | indra/llcommon/llmemory.cpp | 54 | ||||
-rw-r--r-- | indra/llcommon/llmemory.h | 4 |
2 files changed, 2 insertions, 56 deletions
diff --git a/indra/llcommon/llmemory.cpp b/indra/llcommon/llmemory.cpp index 7cf4bc0706..ea84e4c1ea 100644 --- a/indra/llcommon/llmemory.cpp +++ b/indra/llcommon/llmemory.cpp @@ -55,7 +55,6 @@ static LLTrace::SampleStatHandle<F64Megabytes> sVirtualMem("virtual_mem", "virtu U32Kilobytes LLMemory::sAllocatedMemInKB(0); U32Kilobytes LLMemory::sAllocatedPageSizeInKB(0); U32Kilobytes LLMemory::sMaxHeapSizeInKB(U32_MAX); -BOOL LLMemory::sEnableMemoryFailurePrevention = FALSE; void ll_assert_aligned_func(uintptr_t ptr,U32 alignment) { @@ -75,10 +74,9 @@ void ll_assert_aligned_func(uintptr_t ptr,U32 alignment) } //static -void LLMemory::initMaxHeapSizeGB(F32Gigabytes max_heap_size, BOOL prevent_heap_failure) +void LLMemory::initMaxHeapSizeGB(F32Gigabytes max_heap_size) { sMaxHeapSizeInKB = U32Kilobytes::convert(max_heap_size); - sEnableMemoryFailurePrevention = prevent_heap_failure ; } //static @@ -158,56 +156,6 @@ void LLMemory::logMemoryInfo(BOOL update) LL_INFOS() << "Current max usable memory(KB): " << sMaxPhysicalMemInKB << LL_ENDL ; } -//return 0: everything is normal; -//return 1: the memory pool is low, but not in danger; -//return -1: the memory pool is in danger, is about to crash. -//static -bool LLMemory::isMemoryPoolLow() -{ - static const U32Megabytes LOW_MEMORY_POOL_THRESHOLD(64); - const static U32Megabytes MAX_SIZE_CHECKED_MEMORY_BLOCK(64); - static void* last_reserved_address = NULL ; - - if(!sEnableMemoryFailurePrevention) - { - return false ; //no memory failure prevention. - } - - if(sAvailPhysicalMemInKB < (LOW_MEMORY_POOL_THRESHOLD / 4)) //out of physical memory - { - return true ; - } - - if(sAllocatedPageSizeInKB + (LOW_MEMORY_POOL_THRESHOLD / 4) > sMaxHeapSizeInKB) //out of virtual address space. - { - return true ; - } - - bool is_low = (S32)(sAvailPhysicalMemInKB < LOW_MEMORY_POOL_THRESHOLD - || sAllocatedPageSizeInKB + LOW_MEMORY_POOL_THRESHOLD > sMaxHeapSizeInKB) ; - - //check the virtual address space fragmentation - if(!is_low) - { - if(!last_reserved_address) - { - last_reserved_address = LLMemory::tryToAlloc(last_reserved_address, MAX_SIZE_CHECKED_MEMORY_BLOCK.value()) ; - } - else - { - last_reserved_address = LLMemory::tryToAlloc(last_reserved_address, MAX_SIZE_CHECKED_MEMORY_BLOCK.value()) ; - if(!last_reserved_address) //failed, try once more - { - last_reserved_address = LLMemory::tryToAlloc(last_reserved_address, MAX_SIZE_CHECKED_MEMORY_BLOCK.value()) ; - } - } - - is_low = !last_reserved_address ; //allocation failed - } - - return is_low ; -} - //static U32Kilobytes LLMemory::getAvailableMemKB() { diff --git a/indra/llcommon/llmemory.h b/indra/llcommon/llmemory.h index f04ae5f5cb..24f86cc11e 100644 --- a/indra/llcommon/llmemory.h +++ b/indra/llcommon/llmemory.h @@ -344,10 +344,9 @@ public: // Return value is zero if not known. static U64 getCurrentRSS(); static void* tryToAlloc(void* address, U32 size); - static void initMaxHeapSizeGB(F32Gigabytes max_heap_size, BOOL prevent_heap_failure); + static void initMaxHeapSizeGB(F32Gigabytes max_heap_size); static void updateMemoryInfo() ; static void logMemoryInfo(BOOL update = FALSE); - static bool isMemoryPoolLow(); static U32Kilobytes getAvailableMemKB() ; static U32Kilobytes getMaxMemKB() ; @@ -359,7 +358,6 @@ private: static U32Kilobytes sAllocatedPageSizeInKB ; static U32Kilobytes sMaxHeapSizeInKB; - static BOOL sEnableMemoryFailurePrevention; }; // LLRefCount moved to llrefcount.h |