diff --git a/lib/Support/Allocator.cpp b/lib/Support/Allocator.cpp index 36da4432073..7a3fd87c17e 100644 --- a/lib/Support/Allocator.cpp +++ b/lib/Support/Allocator.cpp @@ -15,6 +15,7 @@ #include "llvm/Support/DataTypes.h" #include "llvm/Support/Recycler.h" #include "llvm/Support/raw_ostream.h" +#include "llvm/System/Memory.h" #include namespace llvm { @@ -60,6 +61,7 @@ void BumpPtrAllocator::DeallocateSlabs(MemSlab *Slab) { #ifndef NDEBUG // Poison the memory so stale pointers crash sooner. Note we must // preserve the Size and NextPtr fields at the beginning. + sys::Memory::setRangeWritable(Slab + 1, Slab->Size - sizeof(MemSlab)); memset(Slab + 1, 0xCD, Slab->Size - sizeof(MemSlab)); #endif Allocator.Deallocate(Slab);