The simplest ever way to find where it leaks.
1. Insert well known piece of code in all .cpp files suspected for leakage:
1. Insert well known piece of code in all .cpp files suspected for leakage:
#ifdef _DEBUG2. Use CMemoryState to dump blocks allocated within suspected region:
#define new DEBUG_NEW
#endif
CMemoryState msOld;See further how #define DUMP_NEW can help you automate leak searching
msOld.Checkpoint();
CPerson* pper1 = new CPerson();
CPerson* pper2 = new CPerson();
msOld.DumpAllObjectsSince();