Ejemplo n.º 1
0
TEST(TestMemoryAllocatorTest, SetCurrentMallocAllocator)
{
    allocator = new TestMemoryAllocator("malloc_allocator");
    setCurrentMallocAllocator(allocator);
    POINTERS_EQUAL(allocator, getCurrentMallocAllocator());
    setCurrentMallocAllocatorToDefault();
    POINTERS_EQUAL(defaultMallocAllocator(), getCurrentMallocAllocator());
}
Ejemplo n.º 2
0
void crash_on_allocation_number(unsigned alloc_number)
{
	static CrashOnAllocationAllocator crashAllocator;
	crashAllocator.setNumberToCrashOn(alloc_number);
	setCurrentMallocAllocator(&crashAllocator);
	setCurrentNewAllocator(&crashAllocator);
	setCurrentNewArrayAllocator(&crashAllocator);
}
Ejemplo n.º 3
0
void MemoryReporterPlugin::removeGlobalMemoryReportAllocators()
{
	if (getCurrentNewAllocator() == &newAllocator)
		setCurrentNewAllocator(newAllocator.getRealAllocator());

	if (getCurrentNewArrayAllocator() == &newArrayAllocator)
		setCurrentNewArrayAllocator(newArrayAllocator.getRealAllocator());

	if (getCurrentMallocAllocator() == &mallocAllocator)
		setCurrentMallocAllocator(mallocAllocator.getRealAllocator());
}
Ejemplo n.º 4
0
void MemoryReporterPlugin::setGlobalMemoryReportAllocators()
{
    mallocAllocator.setRealAllocator(getCurrentMallocAllocator());
	setCurrentMallocAllocator(&mallocAllocator);

	newAllocator.setRealAllocator(getCurrentNewAllocator());
	setCurrentNewAllocator(&newAllocator);

	newArrayAllocator.setRealAllocator(getCurrentNewArrayAllocator());
	setCurrentNewArrayAllocator(&newArrayAllocator);
}
Ejemplo n.º 5
0
void cpputest_malloc_set_out_of_memory()
{
    setCurrentMallocAllocator(NullUnknownAllocator::defaultAllocator());
}