diff options
Diffstat (limited to 'lib/ExecutionEngine/JIT/JITMemoryManager.cpp')
-rw-r--r-- | lib/ExecutionEngine/JIT/JITMemoryManager.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/ExecutionEngine/JIT/JITMemoryManager.cpp b/lib/ExecutionEngine/JIT/JITMemoryManager.cpp index 2d64fcfa49..3f38f9c241 100644 --- a/lib/ExecutionEngine/JIT/JITMemoryManager.cpp +++ b/lib/ExecutionEngine/JIT/JITMemoryManager.cpp @@ -351,9 +351,12 @@ namespace { iter = iter->Next; } + largest = largest - sizeof(MemoryRangeHeader); + // If this block isn't big enough for the allocation desired, allocate // another block of memory and add it to the free list. - if (largest - sizeof(MemoryRangeHeader) < ActualSize) { + if (largest < ActualSize || + largest <= FreeRangeHeader::getMinBlockSize()) { DOUT << "JIT: Allocating another slab of memory for function."; candidateBlock = allocateNewCodeSlab((size_t)ActualSize); } |