I use _ CrtDumpMemoryLeaks to identify memory leaks in our software. We use a third-party library in a multi-threaded application. This library has memory leaks, and therefore in our tests we want to identify those that we have and discard those with which we have no control.
We use continuous integration, so new features / algorithms / bug fixes are added all the time.
Therefore, the question arises: is there a safe way to identify those leaks that are ours and those that are a third-party library. Are we about using distribution numbers, but safe?
You can use the DebugDiag tool provided by Microsoft. For complete information about the tool, we can link: http://www.microsoft.com/en-sg/download/details.aspx?id=40336
DebugDiag can be used to identify various problems. We can follow the steps to track leaks (our and third-party module):
, DebugDiag /DLL-, ( ). DebugDiag, , . DLL, DebugDiag. , / PDB, DebugDiag , .
Windows. , .
new delete, (, . new delete) (, HeapCreate). , .
new
delete
HeapCreate
, , . / (, , ) . , , , . , . . Etc ..
. , , , - ? ?
, , . , . , - "" , - . , , static std::vector<int>(100), , ... , , , ( ).
static std::vector<int>(100)
( / ) , , , (, , , ) , , ].
Doug Lea malloc mspace. Mspace - . 100K NCSL- mspace . , STL mspace.
, , Mirosoft heap, . , , , , , _ malloc_dbg, _CLIENT_BLOCK. _ CrtSetDumpClient, , .
_CLIENT_BLOCK
malloc free (, _malloc_dbg); , crtdbg.h, Visual Studio.
malloc
free
_malloc_dbg
crtdbg.h
The hard part for me will be determining how to redefine the statements newand deleteto call debugging functions such as _malloc_dbg. It may be difficult to find a solution in which only affected newand deletein your own code, not a third-party library.