How to test for memory leaks?

Discussion in 'C++' started by p1r0, Aug 21, 2006.

  1. p1r0

    p1r0 Guest

    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
    p1r0, Aug 21, 2006
    #1
    1. Advertising

  2. p1r0

    Phlip Guest

    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!!!
    Phlip, Aug 21, 2006
    #2
    1. Advertising

  3. p1r0

    p1r0 Guest

    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
    p1r0, Aug 21, 2006
    #3
  4. p1r0

    miara Guest

    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
    miara, Aug 21, 2006
    #4
  5. p1r0

    Guest

    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.com 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
    http://photos1.blogger.com/blogger/1261/1990/1600/Soldiervssoldier.jpg


    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
    , Aug 22, 2006
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ASP.Confused

    ASP.NET - Detecting memory leaks

    ASP.Confused, Jul 16, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    2,738
    Marina
    Jul 16, 2004
  2. =?Utf-8?B?RnJhbmsxMjEz?=

    Memory Leaks in ASP.NET

    =?Utf-8?B?RnJhbmsxMjEz?=, Mar 4, 2005, in forum: ASP .Net
    Replies:
    12
    Views:
    13,841
  3. James Hunter Ross

    Our memory leaks?

    James Hunter Ross, Oct 20, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    771
    Bruce Barker
    Oct 20, 2005
  4. Skybuck Flying

    Call oddities: &Test() vs &Test vs Test

    Skybuck Flying, Oct 4, 2009, in forum: C Programming
    Replies:
    1
    Views:
    690
    Skybuck Flying
    Oct 4, 2009
  5. Replies:
    4
    Views:
    118
Loading...

Share This Page