Initialize the PoisonMemory member before initializing

members that call methods that read the PoisonMemory member.
This fixes potential spurious (though probably otherwise
harmless) poising of unused memory, and fixes the
associated valgrind error.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80192 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dan Gohman 2009-08-27 01:25:57 +00:00
parent cdbb3f5d33
commit 5b78d50cad

View File

@ -556,17 +556,17 @@ void JITSlabAllocator::Deallocate(MemSlab *Slab) {
}
DefaultJITMemoryManager::DefaultJITMemoryManager()
: LastSlab(0, 0),
:
#ifdef NDEBUG
PoisonMemory(false),
#else
PoisonMemory(true),
#endif
LastSlab(0, 0),
BumpSlabAllocator(*this),
StubAllocator(DefaultSlabSize, DefaultSizeThreshold, BumpSlabAllocator),
DataAllocator(DefaultSlabSize, DefaultSizeThreshold, BumpSlabAllocator) {
#ifdef NDEBUG
PoisonMemory = false;
#else
PoisonMemory = true;
#endif
// Allocate space for code.
sys::MemoryBlock MemBlock = allocateNewSlab(DefaultCodeSlabSize);
CodeSlabs.push_back(MemBlock);