Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. memory leaks with IMPLEMENT_DYNACREATE

memory leaks with IMPLEMENT_DYNACREATE

Scheduled Pinned Locked Moved C / C++ / MFC
debuggingc++performancequestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jhorstkamp
    wrote on last edited by
    #1

    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

    I 1 Reply Last reply
    0
    • J jhorstkamp

      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

      I Offline
      I Offline
      Iain Clarke Warrior Programmer
      wrote on last edited by
      #2

      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.

      J 1 Reply Last reply
      0
      • I Iain Clarke Warrior Programmer

        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.

        J Offline
        J Offline
        jhorstkamp
        wrote on last edited by
        #3

        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?

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups