How to test for memory leaks?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • p1r0

    How to test for memory leaks?

    Hi

    I was wondering if any of you could recommend me a good tool for
    testing for memry leaks under Windows and/or Linux

    Thanks in advance

    p1r0

  • Phlip

    #2
    Re: How to test for memory leaks?

    p1r0 wrote:
    I was wondering if any of you could recommend me a good tool for
    testing for memry leaks under Windows and/or Linux
    Purify and Valgrind, respectively...

    --
    Phlip
    http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!!


    Comment

    • p1r0

      #3
      Re: How to test for memory leaks?


      Phlip wrote:
      p1r0 wrote:
      >
      I was wondering if any of you could recommend me a good tool for
      testing for memry leaks under Windows and/or Linux
      >
      Purify and Valgrind, respectively...
      >
      --
      Phlip
      http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!!
      Thanks

      Any free ones?

      p1r0

      Comment

      • miara

        #4
        Re: How to test for memory leaks?

        p1r0 wrote:
        Any free ones?
        As far as I know, Valgrind is a free one.

        check it's site: http://valgrind.org/

        --
        regards,
        Tomasz Miarowski

        Comment

        • defendusa2@yahoo.com

          #5
          Re: How to test for memory leaks?

          Some static code analyzers will check for potential memory leaks.

          PC-Lint isn't very expensive (a few hundred bucks). Coverity is better
          but is much more expensive. I think turning the Visual C++ compiler
          warning level all the way up (to 4) will find some potential problems.
          Other compilers might be able to detect potential memory leaks also.

          Sysinternals.co m has some tools that might help. I tracked down a
          handle leak using their task manager replacement. Microsoft also has a
          tool called umdh which I haven't used but I know others that have.

          btw: The company I worked for evaluated Coverity. It ran for a day and
          located a bunch of problems, one of which was a memory leak that one of
          my coworkers had just spent a month (on and off) tracking down, not to
          mention the customer, customer support, etc. I think that PC-Lint and
          the other static code analyzers might have found it also.

          The other thing is that there are ways to reduce the odds of a memory
          leak occurring. I don't know if you do this or not, but using libraries
          such as the stl, instead of rolling your own, using a string class
          instead of char *, using object that autorelease your locks, handles,
          close files, etc. for you and catching and handling exceptions will
          help. If you are not doing these, then detecting memory leaks is like
          patching the Titanic with a bandaid. It is better to prevent the
          problem than patch the holes one by one.

          ---------------------------------------------
          bumperstickers:http://www.cafepress.com/bush_doggers?pid=2794571



          miara wrote:
          p1r0 wrote:
          >
          Any free ones?
          >
          As far as I know, Valgrind is a free one.
          >
          check it's site: http://valgrind.org/
          >
          --
          regards,
          Tomasz Miarowski

          Comment

          Working...