I am working on a MFC Visual C ++ project. As I understand from MSDN , _CrtDumpMemoryLeaks() should return TRUE when there are memory leaks.
Noticing that TRUE, I tried to find the first point in the code where it will become TRUE. Obviously, this is true from the very beginning. If I press F10 (step by step) to start debugging the program and enter _CrtDumpMemoryLeaks() in the viewport, it will display TRUE even before the first line of code at the program entry point:
extern "C" int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, _In_ LPTSTR lpCmdLine, int nCmdShow) #pragma warning(suppress: 4985) {
In addition, I suggested that perhaps the debugging objects are not initializing at this point and that the truth is erroneous. Therefore, I set a breakpoint on the first line in the OnInitDialog() function, and there is also a TRUE value.
Why do I have a memory leak at the beginning of the program?
memory-leaks visual-c ++ mfc
Jonathan
source share