Numbers in C ++ (windows) and its predictability

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?

+4
source share
5 answers

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):

  • Configure DebugDiag under the rule type "Native (non-.NET) memory and handle leak".
  • Now restart the application for a while and write down the dump files. We can also configure DebugDiag to capture the dump file after the specified interval.
  • / DebugDiag " ".

, DebugDiag /DLL-, ( ). DebugDiag, , . DLL, DebugDiag. , / PDB, DebugDiag , .

Windows. , .

0

new delete, (, . new delete) (, HeapCreate). , .

, , . / (, , ) . , , , . , . . Etc ..

+4

. , , , - ? ?

, , . , . , - "" , - . , , static std::vector<int>(100), , ... , , , ( ).

( / ) , , , (, , , ) , , ].

+1

Doug Lea malloc mspace. Mspace - . 100K NCSL- mspace . , STL mspace.

  • mspaces, ( )
  • mspace, , .
  • mspace, , .
+1

, , Mirosoft heap, . , , , , , _ malloc_dbg, _CLIENT_BLOCK. _ CrtSetDumpClient, , .

malloc free (, _malloc_dbg); , crtdbg.h, Visual Studio.

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.

+1
source

All Articles