TEST(TestMemoryAllocatorTest, SetCurrentMallocAllocator) { allocator = new TestMemoryAllocator("malloc_allocator"); setCurrentMallocAllocator(allocator); POINTERS_EQUAL(allocator, getCurrentMallocAllocator()); setCurrentMallocAllocatorToDefault(); POINTERS_EQUAL(defaultMallocAllocator(), getCurrentMallocAllocator()); }
MemoryReportFormatter* MemoryReporterPlugin::createMemoryFormatter(const SimpleString& type) { if (type == "normal") { return new NormalMemoryReportFormatter; } else if (type == "code") { return new CodeMemoryReportFormatter(defaultMallocAllocator()); } return NULL; }
TEST(TestMemoryAllocatorTest, MallocNames) { STRCMP_EQUAL("Standard Malloc Allocator", defaultMallocAllocator()->name()); STRCMP_EQUAL("malloc", defaultMallocAllocator()->alloc_name()); STRCMP_EQUAL("free", defaultMallocAllocator()->free_name()); }
void setCurrentMallocAllocatorToDefault() { currentMallocAllocator = defaultMallocAllocator(); }