TEST(TestMemoryAllocatorTest, SetCurrentMallocAllocator) { allocator = new TestMemoryAllocator("malloc_allocator"); setCurrentMallocAllocator(allocator); POINTERS_EQUAL(allocator, getCurrentMallocAllocator()); setCurrentMallocAllocatorToDefault(); POINTERS_EQUAL(defaultMallocAllocator(), getCurrentMallocAllocator()); }
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); }
void cpputest_malloc_set_out_of_memory() { setCurrentMallocAllocator(NullUnknownAllocator::defaultAllocator()); }