Пример #1
0
TEST(TestMemoryAllocatorTest, SetCurrentNewArrayAllocator)
{
    allocator = new TestMemoryAllocator("new array allocator for test");
    setCurrentNewArrayAllocator(allocator);
    POINTERS_EQUAL(allocator, getCurrentNewArrayAllocator());
    setCurrentNewArrayAllocatorToDefault();
    POINTERS_EQUAL(defaultNewArrayAllocator(), getCurrentNewArrayAllocator());
}
Пример #2
0
void MemoryReporterPlugin::removeGlobalMemoryReportAllocators()
{
	if (getCurrentNewAllocator() == &newAllocator)
		setCurrentNewAllocator(newAllocator.getRealAllocator());

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

	if (getCurrentMallocAllocator() == &mallocAllocator)
		setCurrentMallocAllocator(mallocAllocator.getRealAllocator());
}
Пример #3
0
void MemoryReporterPlugin::setGlobalMemoryReportAllocators()
{
    mallocAllocator.setRealAllocator(getCurrentMallocAllocator());
	setCurrentMallocAllocator(&mallocAllocator);

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

	newArrayAllocator.setRealAllocator(getCurrentNewArrayAllocator());
	setCurrentNewArrayAllocator(&newArrayAllocator);
}
Пример #4
0
TEST(SimpleString, defaultAllocatorIsNewArrayAllocator)
{
	POINTERS_EQUAL(getCurrentNewArrayAllocator(), SimpleString::getStringAllocator());
}
Пример #5
0
 void free_memory(char* str, const char* file, int line)
 {
   MemoryLeakWarningPlugin::getGlobalDetector()->deallocMemory(getCurrentNewArrayAllocator(), str, (char*) file, line);
 }
Пример #6
0
 char* alloc_memory(size_t size, const char* file, int line)
 {
   return MemoryLeakWarningPlugin::getGlobalDetector()->allocMemory(getCurrentNewArrayAllocator(), size, (char*) file, line);
 }
static void mem_leak_operator_delete_array (void* mem) UT_THROW_EMPTY()
{
	MemoryLeakWarningPlugin::getGlobalDetector()->invalidateMemory((char*) mem);
	MemoryLeakWarningPlugin::getGlobalDetector()->deallocMemory(getCurrentNewArrayAllocator(), (char*) mem);
}
static void* mem_leak_operator_new_array_nothrow (size_t size) UT_THROW_EMPTY()
{
	return MemoryLeakWarningPlugin::getGlobalDetector()->allocMemory(getCurrentNewArrayAllocator(), size);
}