memory leaks with IMPLEMENT_DYNACREATE
-
All, My VC7 debugger is catching memory leaks (I inherited a project with a lot of "new" and not a lot of "delete"...) which I am in the process of cleaning up. Several of the "caught" leaks take me to the IMPLEMENT_DYNACREATE macro in a few classes, most notably the MainFrm.cpp, the view class.cpp and the doc class.cpp files when I click on them in the debug window. I don't know where to go from there. Any suggestions? Thanks in advance, John
-
All, My VC7 debugger is catching memory leaks (I inherited a project with a lot of "new" and not a lot of "delete"...) which I am in the process of cleaning up. Several of the "caught" leaks take me to the IMPLEMENT_DYNACREATE macro in a few classes, most notably the MainFrm.cpp, the view class.cpp and the doc class.cpp files when I click on them in the debug window. I don't know where to go from there. Any suggestions? Thanks in advance, John
You need to look for things like... RUNTIME_CLASS (CLeakingObject) and CRuntimeClass->CreateObject (); and so on. If you look at the definition of the macro, you can see the Create functions it hides. Iain.
-
You need to look for things like... RUNTIME_CLASS (CLeakingObject) and CRuntimeClass->CreateObject (); and so on. If you look at the definition of the macro, you can see the Create functions it hides. Iain.
Thanks - not sure I understand... Clicking on one of the memory leak messages in the debug window takes me to: IMPLEMENT_DYNCREATE(CPalsView, CScrollView) The next is: IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd) and the last is: IMPLEMENT_DYNCREATE(CPalsDoc, CDocument) does this mean that it thinks I (or maybe MFC) has a memory leak in one of these classes? The only place I see the RUNTIME_CLASS macro is here in the App.InitInstance function: CSingleDocTemplate* pDocTemplate; pDocTemplate = new CSingleDocTemplate( IDR_MAINFRAME, RUNTIME_CLASS(CPalsDoc), RUNTIME_CLASS(CMainFrame), // main SDI frame window RUNTIME_CLASS(CPalsView)); AddDocTemplate(pDocTemplate); which is of course a memory leak since I can't seem to find a cooresponding delete (unless MFC is handling that in some hidden way) ???? Any comments?