TEST_F(TestBasicsDisabled, Strdup) { int prev = static_cast<int>(VLDGetLeaksCount()); LeakMemory(eStrdup, repeats, false); int total = static_cast<int>(VLDGetLeaksCount()); int leaks = total - prev; ASSERT_EQ(0, leaks); }
void object::test<6>() { set_test_name("CoTaskMem"); int prev = (int)VLDGetLeaksCount(); LeakMemory(eCoTaskMem,repeat,false); int leaks = (int)VLDGetLeaksCount() - prev; ensure("leaks", leaks == (repeat * 1)); }
void object::test<5>() { set_test_name("Realloc"); int prev = (int)VLDGetLeaksCount(); LeakMemory(eRealloc,repeat,false); int leaks = (int)VLDGetLeaksCount() - prev; ensure("leaks", leaks == (repeat * 2)); }
void object::test<3>() { set_test_name("NewArray"); int prev = (int)VLDGetLeaksCount(); LeakMemory(eNewArray,repeat,false); int leaks = (int)VLDGetLeaksCount() - prev; ensure("leaks", leaks == (repeat * 2)); }
void object::test<9>() { set_test_name("Strdup"); int prev = (int)VLDGetLeaksCount(); LeakMemory(eStrdup,repeat,false); int leaks = (int)VLDGetLeaksCount() - prev; ensure("leaks", leaks == (repeat * 4)); }
int Test() { VLDSetOptions(VLD_OPT_TRACE_INTERNAL_FRAMES | VLD_OPT_SKIP_CRTSTARTUP_LEAKS, 256, 64); void* m = malloc(50); // 8 char* n = new char[60]; // 9 memset(s_m, '1', 10); memset(s_n, '2', 20); memset(g_m, '3', 30); memset(g_n, '4', 40); memset(m, '5', 50); memset(n, '6', 60); // std libary dynamically initializes the objects "cout" and "cerr", which // produce false positive leaks in Release_StaticCrt because we doesn't have // debug CRT allocation header. std::cout << "Test: cout"; //std::cerr << "Test: cerr"; // At this point VLDGetLeaksCount() and VLDReportLeaks() should report 9 leaks // including a leak for ml which has not been freed yet. ml will be freed after // _tmain exits but before VLDReportLeaks() is called internally by VLD and // therefore correctly report 8 leaks. int leaks = VLDGetLeaksCount(); VLDReportLeaks(); // at this point should report 9 leaks; return leaks; }
int Test() { VLDSetOptions(VLD_OPT_TRACE_INTERNAL_FRAMES | VLD_OPT_SKIP_CRTSTARTUP_LEAKS, 256, 64); void* m = malloc(50); // 8 char* n = new char[60]; // 9 memset(s_m, '1', 10); memset(s_n, '2', 20); memset(g_m, '3', 30); memset(g_n, '4', 40); memset(m, '5', 50); memset(n, '6', 60); // At this point VLDGetLeaksCount() and VLDReportLeaks() should report 9 leaks // including a leak for ml which has not been freed yet. ml will be freed after // _tmain exits but before VLDReportLeaks() is called internally by VLD and // therefore correctly report 8 leaks. // VLDReportLeaks(); // at this point should report 9 leaks; return VLDGetLeaksCount(); }