see ya later allocator
This commit is contained in:
parent
57d5591d4a
commit
fa2d0aaa92
44 changed files with 32 additions and 1693 deletions
|
|
@ -1,36 +0,0 @@
|
|||
|
||||
#include "Allocators.hpp"
|
||||
#include "HeapAllocatorGlobal.hpp"
|
||||
|
||||
#include <cstdlib>
|
||||
#include <stdio.h>
|
||||
|
||||
static bool init(const tp::ModuleManifest* self) {
|
||||
tp::HeapAllocGlobal::stopIgnore();
|
||||
if (tp::HeapAllocGlobal::getNAllocations()) {
|
||||
printf("Warning : Operator new was called outside module initialization!!\n\n");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static void deinit(const tp::ModuleManifest* self) {
|
||||
tp::HeapAllocGlobal::checkLeaks();
|
||||
}
|
||||
|
||||
static tp::ModuleManifest* sModuleDependencies[] = { nullptr };
|
||||
tp::ModuleManifest tp::gModuleAllocators = ModuleManifest("Allocators", init, deinit, sModuleDependencies);
|
||||
|
||||
void* operator new(size_t aSize) { return tp::HeapAllocGlobal::allocate(aSize); }
|
||||
void* operator new[](size_t aSize) { return tp::HeapAllocGlobal::allocate(aSize); }
|
||||
void operator delete(void* aPtr) noexcept { tp::HeapAllocGlobal::deallocate(aPtr); }
|
||||
void operator delete[](void* aPtr) noexcept { tp::HeapAllocGlobal::deallocate(aPtr); }
|
||||
|
||||
void* operator new(size_t aSize, tp::HeapAlloc& aAlloc) { return aAlloc.allocate(aSize); }
|
||||
void* operator new[](size_t aSize, tp::HeapAlloc& aAlloc) { return aAlloc.allocate(aSize); }
|
||||
void operator delete(void* aPtr, tp::HeapAlloc& aAlloc) { aAlloc.deallocate(aPtr); }
|
||||
void operator delete[](void* aPtr, tp::HeapAlloc& aAlloc) { aAlloc.deallocate(aPtr); }
|
||||
|
||||
void* operator new(size_t aSize, tp::HeapAllocGlobal& aAlloc) { return tp::HeapAllocGlobal::allocate(aSize); }
|
||||
void* operator new[](size_t aSize, tp::HeapAllocGlobal& aAlloc) { return tp::HeapAllocGlobal::allocate(aSize); }
|
||||
void operator delete(void* aPtr, tp::HeapAllocGlobal& aAlloc) { tp::HeapAllocGlobal::deallocate(aPtr); }
|
||||
void operator delete[](void* aPtr, tp::HeapAllocGlobal& aAlloc) { tp::HeapAllocGlobal::deallocate(aPtr); }
|
||||
Loading…
Add table
Add a link
Reference in a new issue