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. How to check the memory leak

How to check the memory leak

Scheduled Pinned Locked Moved C / C++ / MFC
performancetutorialquestion
7 Posts 6 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.
  • Y Offline
    Y Offline
    yu jian
    wrote on last edited by
    #1

    I use the #ifdef _DEBUG #define new DEBUG_NEW #endif to check the memory leak, but it output a lot of non-useful info, Is there good way to check where the memory leak?

    J H T L Y 5 Replies Last reply
    0
    • Y yu jian

      I use the #ifdef _DEBUG #define new DEBUG_NEW #endif to check the memory leak, but it output a lot of non-useful info, Is there good way to check where the memory leak?

      J Offline
      J Offline
      jk chan
      wrote on last edited by
      #2

      normally when u create project in Visual studio ,and after debugging it (ofcourse in debug mode) , when u close the app, Visual studio will shows any unfreezed memory in the output window( ALT+CTRL+ O). sometimes this information is sufficient to detect the memory leak(depends on codes and the persons knowledge) if u r trying to find memory leak and vs's output is not sufficient try using boundsckecer or similar softwares ( http://en.wikipedia.org/wiki/BoundsChecker) . Boundschecker is not free. visual leak detector is a free one(http://www.codeproject.com/KB/applications/visualleakdetector.aspx) hopes this helps.

      If u can Dream... U can do it

      1 Reply Last reply
      0
      • Y yu jian

        I use the #ifdef _DEBUG #define new DEBUG_NEW #endif to check the memory leak, but it output a lot of non-useful info, Is there good way to check where the memory leak?

        H Offline
        H Offline
        Hadi Dayvary
        wrote on last edited by
        #3

        HI This macro can only report the memory leak that has been made by new.

        www.logicsims.ir

        1 Reply Last reply
        0
        • Y yu jian

          I use the #ifdef _DEBUG #define new DEBUG_NEW #endif to check the memory leak, but it output a lot of non-useful info, Is there good way to check where the memory leak?

          T Offline
          T Offline
          T2102
          wrote on last edited by
          #4

          Assuming you have no calls to calloc and malloc, ... http://stackoverflow.com/questions/3509214/overloading-new-and-delete-in-c An exception could be the source of the problem since class destructors are not called if an exception is encountered and not handled.

          1 Reply Last reply
          0
          • Y yu jian

            I use the #ifdef _DEBUG #define new DEBUG_NEW #endif to check the memory leak, but it output a lot of non-useful info, Is there good way to check where the memory leak?

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            I'm partial to GlowCode[^]. If you have a few hundred dollars to invest, I'd recommend it.

            L u n a t i c F r i n g e

            1 Reply Last reply
            0
            • Y yu jian

              I use the #ifdef _DEBUG #define new DEBUG_NEW #endif to check the memory leak, but it output a lot of non-useful info, Is there good way to check where the memory leak?

              Y Offline
              Y Offline
              yu jian
              wrote on last edited by
              #6

              Thanks for all your reply. Happy new year. :-D

              P 1 Reply Last reply
              0
              • Y yu jian

                Thanks for all your reply. Happy new year. :-D

                P Offline
                P Offline
                pacchij
                wrote on last edited by
                #7

                Generally I prefer UMDH. Its free from microsoft and works great. We can customize memory leak detections to some UI operations, a DLL.

                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