Azure / vld

Visual Leak Detector for Visual C++ 2008-2015
https://kinddragon.github.io/vld/
GNU Lesser General Public License v2.1
42 stars 25 forks source link

VLD detects memory leaks in googletest library building project as Multi-threaded Debug #15

Open netmonitoring opened 2 years ago

netmonitoring commented 2 years ago

VLD detects memory leaks in googletest library building project as Multi-threaded Debug (/MTd) (output below).

Building the project as Multi-threaded Debug DLL (/MDd), VLD does not catch whose leaks.

Visual Leak Detector read settings from: C:\test\build\bin\vld.ini Visual Leak Detector Version 2.5.8 installed. Running main() from C:\test\googletest\googletest\src\gtest_main.cc [==========] Running 1 test from 1 test suite. [----------] Global test environment set-up. [----------] 1 test from AppUnitTest [ RUN ] AppUnitTest.Test [ OK ] AppUnitTest.Test (0 ms) [----------] 1 test from AppUnitTest (1 ms total)

[----------] Global test environment tear-down [==========] 1 test from 1 test suite ran. (4 ms total) [ PASSED ] 1 test. WARNING: Visual Leak Detector detected memory leaks! ---------- Block 844 at 0x00000000AE693C10: 64 bytes ---------- Leak Hash: 0x139C30F4, Count: 1, Total 64 bytes Call Stack (TID 26640): Data: 10 3C 69 AE D3 01 00 00 10 3C 69 AE D3 01 00 00 .<i..... .<i..... 10 3C 69 AE D3 01 00 00 01 01 CD CD CD CD CD CD .<i..... ........ CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD ........ ........ CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD ........ ........

---------- Block 842 at 0x00000000AE695090: 24 bytes ---------- Leak Hash: 0x34CD339C, Count: 1, Total 24 bytes Call Stack (TID 26640): ntdll.dll!RtlAllocateHeap() d:\a01_work\43\s\src\vctools\crt\vcstartup\src\heap\new_scalar.cpp (35): app_unit_test.exe!operator new() + 0xA bytes C:\test\googletest\googletest\src\gtest-port.cc (661): app_unit_test.exe!testing::internal::ThreadLocalRegistryImpl::GetThreadLocalsMapLocked() + 0x44 bytes C:\test\googletest\googletest\src\gtest-port.cc (556): app_unit_test.exe!testing::internal::ThreadLocalRegistryImpl::OnThreadLocalDestroyed() + 0x5 bytes C:\test\googletest\googletest\src\gtest-port.cc (683): app_unit_test.exe!testing::internal::ThreadLocalRegistry::OnThreadLocalDestroyed() C:\test\googletest\googletest\include\gtest\internal\gtest-port.h (1532): app_unit_test.exe!testing::internal::ThreadLocal<std::vector<testing::internal::TraceInfo,std::allocator > >::~ThreadLocal<std::vector<testing::internal::TraceInfo,std::allocator > >() + 0x23 bytes C:\test\googletest\googletest\src\gtest.cc (5599): app_unit_test.exe!testing::internal::UnitTestImpl::~UnitTestImpl() + 0x13 bytes app_unit_test.exe!testing::internal::UnitTestImpl::scalar deleting destructor'() + 0x18 bytes C:\test\googletest\googletest\src\gtest.cc (5542): app_unit_test.exe!testing::UnitTest::~UnitTest() + 0x34 bytes app_unit_test.exe!testing::UnitTest::GetInstance'::2'::dynamic atexit destructor for 'instance''() + 0x12 bytes minkernel\crts\ucrt\src\appcrt\startup\onexit.cpp (206): app_unit_test.exe!::operator()() VCCRT\vcruntime\inc\internal_shared.h (204): app_unit_test.exe!crt_seh_guarded_call::operator()<, &, >() + 0xA bytes minkernel\crts\ucrt\inc\corecrt_internal.h (980): app_unit_test.exe!__acrt_lock_and_call< >() minkernel\crts\ucrt\src\appcrt\startup\onexit.cpp (231): app_unit_test.exe!_execute_onexit_table() minkernel\crts\ucrt\src\appcrt\startup\exit.cpp (226): app_unit_test.exe!::operator()() + 0xC bytes VCCRT\vcruntime\inc\internal_shared.h (224): app_unit_test.exe!crt_seh_guarded_call::operator()<, &, >() + 0xA bytes minkernel\crts\ucrt\inc\corecrt_internal.h (980): app_unit_test.exe!acrt_lock_and_call< >() minkernel\crts\ucrt\src\appcrt\startup\exit.cpp (259): app_unit_test.exe!common_exit() minkernel\crts\ucrt\src\appcrt\startup\exit.cpp (294): app_unit_test.exe!exit() d:\a01_work\43\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl (297): app_unit_test.exe!__scrt_common_main_seh() d:\a01_work\43\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl (331): app_unit_test.exe!scrt_common_main() d:\a01_work\43\s\src\vctools\crt\vcstartup\src\startup\exe_main.cpp (17): app_unit_test.exe!mainCRTStartup() KERNEL32.DLL!BaseThreadInitThunk() + 0x14 bytes ntdll.dll!RtlUserThreadStart() + 0x21 bytes Data: 60 76 69 AE D3 01 00 00 10 3C 69 AE D3 01 00 00 `vi..... .<i..... 00 00 00 00 00 00 00 00 ........ ........

---------- Block 843 at 0x00000000AE697660: 16 bytes ---------- Leak Hash: 0xC8E434DD, Count: 1, Total 16 bytes Call Stack (TID 26640): Data: 90 50 69 AE D3 01 00 00 00 00 00 00 00 00 00 00 .Pi..... ........

---------- Block 841 at 0x00000000AE698640: 40 bytes ---------- Leak Hash: 0x57875347, Count: 1, Total 40 bytes Call Stack (TID 26640): ntdll.dll!RtlAllocateHeap() d:\a01_work\43\s\src\vctools\crt\vcstartup\src\heap\new_scalar.cpp (35): app_unit_test.exe!operator new() + 0xA bytes C:\test\googletest\googletest\src\gtest-port.cc (412): app_unit_test.exe!testing::internal::Mutex::ThreadSafeLazyInit() + 0xA bytes C:\test\googletest\googletest\src\gtest-port.cc (341): app_unit_test.exe!testing::internal::Mutex::Lock() C:\test\googletest\googletest\include\gtest\internal\gtest-port.h (1395): app_unit_test.exe!testing::internal::GTestMutexLock::GTestMutexLock() + 0x1A bytes C:\test\googletest\googletest\src\gtest-port.cc (555): app_unit_test.exe!testing::internal::ThreadLocalRegistryImpl::OnThreadLocalDestroyed() + 0x11 bytes C:\test\googletest\googletest\src\gtest-port.cc (683): app_unit_test.exe!testing::internal::ThreadLocalRegistry::OnThreadLocalDestroyed() C:\test\googletest\googletest\include\gtest\internal\gtest-port.h (1532): app_unit_test.exe!testing::internal::ThreadLocal<std::vector<testing::internal::TraceInfo,std::allocator > >::~ThreadLocal<std::vector<testing::internal::TraceInfo,std::allocator > >() + 0x23 bytes C:\test\googletest\googletest\src\gtest.cc (5599): app_unit_test.exe!testing::internal::UnitTestImpl::~UnitTestImpl() + 0x13 bytes app_unit_test.exe!testing::internal::UnitTestImpl::scalar deleting destructor'() + 0x18 bytes C:\test\googletest\googletest\src\gtest.cc (5542): app_unit_test.exe!testing::UnitTest::~UnitTest() + 0x34 bytes app_unit_test.exe!testing::UnitTest::GetInstance'::2'::dynamic atexit destructor for 'instance''() + 0x12 bytes minkernel\crts\ucrt\src\appcrt\startup\onexit.cpp (206): app_unit_test.exe!::operator()() VCCRT\vcruntime\inc\internal_shared.h (204): app_unit_test.exe!crt_seh_guarded_call::operator()<, &, >() + 0xA bytes minkernel\crts\ucrt\inc\corecrt_internal.h (980): app_unit_test.exe!__acrt_lock_and_call< >() minkernel\crts\ucrt\src\appcrt\startup\onexit.cpp (231): app_unit_test.exe!_execute_onexit_table() minkernel\crts\ucrt\src\appcrt\startup\exit.cpp (226): app_unit_test.exe!::operator()() + 0xC bytes VCCRT\vcruntime\inc\internal_shared.h (224): app_unit_test.exe!crt_seh_guarded_call::operator()<, &, >() + 0xA bytes minkernel\crts\ucrt\inc\corecrt_internal.h (980): app_unit_test.exe!acrt_lock_and_call< >() minkernel\crts\ucrt\src\appcrt\startup\exit.cpp (259): app_unit_test.exe!common_exit() minkernel\crts\ucrt\src\appcrt\startup\exit.cpp (294): app_unit_test.exe!exit() d:\a01_work\43\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl (297): app_unit_test.exe!__scrt_common_main_seh() d:\a01_work\43\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl (331): app_unit_test.exe!scrt_common_main() d:\a01_work\43\s\src\vctools\crt\vcstartup\src\startup\exe_main.cpp (17): app_unit_test.exe!mainCRTStartup() KERNEL32.DLL!BaseThreadInitThunk() + 0x14 bytes ntdll.dll!RtlUserThreadStart() + 0x21 bytes Data: FF FF FF FF FF FF FF FF FF FF FF FF 00 00 00 00 ........ ........ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ D0 07 00 02 00 00 00 00 ........ ........

Visual Leak Detector detected 4 memory leaks (352 bytes). Largest number used: 40773 bytes. Total allocations: 127947 bytes. Visual Leak Detector is now exiting.