/// one.
void DeallocateSlabs(MemSlab *Slab);
- static MallocSlabAllocator DefaultSlabAllocator;
+ static MallocSlabAllocator &GetDefaultSlabAllocator();
public:
BumpPtrAllocator(size_t size = 4096, size_t threshold = 4096,
- SlabAllocator &allocator = DefaultSlabAllocator);
+ SlabAllocator &allocator = GetDefaultSlabAllocator());
~BumpPtrAllocator();
/// Reset - Deallocate all but the current slab and reset the current pointer
<< " (includes alignment, etc)\n";
}
-MallocSlabAllocator BumpPtrAllocator::DefaultSlabAllocator =
- MallocSlabAllocator();
+MallocSlabAllocator &BumpPtrAllocator::GetDefaultSlabAllocator() {
+ static MallocSlabAllocator DefaultSlabAllocator;
+ return DefaultSlabAllocator;
+}
SlabAllocator::~SlabAllocator() { }