void crash_on_allocation_number(unsigned alloc_number)
{
	static CrashOnAllocationAllocator crashAllocator;
	crashAllocator.setNumberToCrashOn(alloc_number);
	setCurrentMallocAllocator(&crashAllocator);
	setCurrentNewAllocator(&crashAllocator);
	setCurrentNewArrayAllocator(&crashAllocator);
}
Exemplo n.º 2
0
void MemoryReporterPlugin::removeGlobalMemoryReportAllocators()
{
	if (getCurrentNewAllocator() == &newAllocator)
		setCurrentNewAllocator(newAllocator.getRealAllocator());

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

	if (getCurrentMallocAllocator() == &mallocAllocator)
		setCurrentMallocAllocator(mallocAllocator.getRealAllocator());
}
Exemplo n.º 3
0
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);
 }