void crash_on_allocation_number(unsigned alloc_number) { static CrashOnAllocationAllocator crashAllocator; crashAllocator.setNumberToCrashOn(alloc_number); setCurrentMallocAllocator(&crashAllocator); setCurrentNewAllocator(&crashAllocator); setCurrentNewArrayAllocator(&crashAllocator); }
void MemoryReporterPlugin::removeGlobalMemoryReportAllocators() { if (getCurrentNewAllocator() == &newAllocator) setCurrentNewAllocator(newAllocator.getRealAllocator()); if (getCurrentNewArrayAllocator() == &newArrayAllocator) setCurrentNewArrayAllocator(newArrayAllocator.getRealAllocator()); if (getCurrentMallocAllocator() == &mallocAllocator) setCurrentMallocAllocator(mallocAllocator.getRealAllocator()); }
void MemoryReporterPlugin::setGlobalMemoryReportAllocators() { mallocAllocator.setRealAllocator(getCurrentMallocAllocator()); setCurrentMallocAllocator(&mallocAllocator); newAllocator.setRealAllocator(getCurrentNewAllocator()); setCurrentNewAllocator(&newAllocator); newArrayAllocator.setRealAllocator(getCurrentNewArrayAllocator()); setCurrentNewArrayAllocator(&newArrayAllocator); }
~TemporaryDefaultNewAllocator() { setCurrentNewAllocator(newAllocator); }
TemporaryDefaultNewAllocator(TestMemoryAllocator* oldAllocator) { newAllocator = getCurrentNewAllocator(); setCurrentNewAllocator(oldAllocator); }