Memory leak detection tools?

Discussion in 'C++' started by kk_oop@yahoo.com, Nov 2, 2006.

  1. Guest

    Hi. Any recommendations for memory leak detection tools for C++ running
    on Linux or Solaris? I'm interested in static (compile time) and
    runtime detection. It's for a large project.

    Thanks!

    Ken
     
    , Nov 2, 2006
    #1
    1. Advertising

  2. Larry Smith Guest

    wrote:
    > Hi. Any recommendations for memory leak detection tools for C++ running
    > on Linux or Solaris? I'm interested in static (compile time) and
    > runtime detection. It's for a large project.
    >
    > Thanks!
    >
    > Ken
    >


    Try the newsgroup

    comp.os.linux.development.system
     
    Larry Smith, Nov 2, 2006
    #2
    1. Advertising

  3. wrote:
    > Hi. Any recommendations for memory leak detection tools for C++ running
    > on Linux or Solaris? I'm interested in static (compile time) and
    > runtime detection.


    For runtime detection, without the need to recompile,
    you might try valgrind, if it is supported on your platform.

    > It's for a large project.


    That might be difficult -- programs run under valgrind
    during debugging tend to consume memory and CPU power
    in the order of ten times the original program.
    But worth a try.

    HTH,
    - J.
     
    Jacek Dziedzic, Nov 2, 2006
    #3
  4. Ian Collins Guest

    wrote:
    > Hi. Any recommendations for memory leak detection tools for C++ running
    > on Linux or Solaris? I'm interested in static (compile time) and
    > runtime detection. It's for a large project.
    >

    Try comp.unix.programmer. Sun's dbx does the runtime part.

    Use of your own operator new can also provide run time data.

    --
    Ian Collins.
     
    Ian Collins, Nov 3, 2006
    #4
  5. VJ Guest

    Jacek Dziedzic wrote:
    > wrote:
    >
    >> Hi. Any recommendations for memory leak detection tools for C++ running
    >> on Linux or Solaris? I'm interested in static (compile time) and
    >> runtime detection.

    >
    >
    > For runtime detection, without the need to recompile,
    > you might try valgrind, if it is supported on your platform.


    valgrind is supported on linux

    >
    >> It's for a large project.

    >
    >
    > That might be difficult -- programs run under valgrind
    > during debugging tend to consume memory and CPU power
    > in the order of ten times the original program.
    > But worth a try.
    >


    If he makes small unit tests, he can use valgrind on those, and at the
    same time test both unit tests and his code

    I agree it is much slower then normal compilation
     
    VJ, Nov 3, 2006
    #5
  6. Ian Collins Guest

    VJ wrote:
    >
    > If he makes small unit tests, he can use valgrind on those, and at the
    > same time test both unit tests and his code
    >

    If he has the good sense to produce decent unit tests, adding operator
    new() and delete() to the test harness will serve him well. No need for
    anything else.

    --
    Ian Collins.
     
    Ian Collins, Nov 3, 2006
    #6
  7. VJ wrote:
    > Jacek Dziedzic wrote:
    >
    >> wrote:
    >>
    >>> Hi. Any recommendations for memory leak detection tools for C++ running
    >>> on Linux or Solaris? I'm interested in static (compile time) and
    >>> runtime detection.

    >>
    >>
    >>
    >> For runtime detection, without the need to recompile,
    >> you might try valgrind, if it is supported on your platform.

    >
    >
    > valgrind is supported on linux


    Yes, but not for all architectures, like IA-64, for instance.

    - J.
     
    Jacek Dziedzic, Nov 3, 2006
    #7
  8. VJ Guest

    Ian Collins wrote:
    > VJ wrote:
    >
    >>If he makes small unit tests, he can use valgrind on those, and at the
    >>same time test both unit tests and his code
    >>

    >
    > If he has the good sense to produce decent unit tests, adding operator
    > new() and delete() to the test harness will serve him well. No need for
    > anything else.
    >


    Shit happens, cause noone is perfect, therefore testing for memory leaks
    in unit tests is not bad, just takes time and should not be used often.

    Murphies law rules everywhere ;)
     
    VJ, Nov 3, 2006
    #8
  9. Ian Collins Guest

    VJ wrote:
    > Ian Collins wrote:
    >
    >> VJ wrote:
    >>
    >>> If he makes small unit tests, he can use valgrind on those, and at the
    >>> same time test both unit tests and his code
    >>>

    >>
    >> If he has the good sense to produce decent unit tests, adding operator
    >> new() and delete() to the test harness will serve him well. No need for
    >> anything else.
    >>

    >
    > Shit happens, cause noone is perfect, therefore testing for memory leaks
    > in unit tests is not bad, just takes time and should not be used often.
    >

    I think you miss my point, if you provide your own memory manager, you
    can have memory leak detection almost free, just by keeping tabs on all
    allocated blocks.

    The same applies with Sun's dbx, there is next to no overhead running
    with memory leak detection enabled. Access violation detection is an
    other story.

    --
    Ian Collins.
     
    Ian Collins, Nov 3, 2006
    #9
    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. __jakal__

    c++ memory leak detection

    __jakal__, Apr 28, 2004, in forum: C++
    Replies:
    9
    Views:
    5,087
    StarDrago
    May 24, 2012
  2. Spur
    Replies:
    1
    Views:
    409
    Howard Hinnant
    May 9, 2004
  3. Winbatch

    Memory Leak Detection

    Winbatch, Feb 23, 2005, in forum: C++
    Replies:
    11
    Views:
    8,305
    NitinTheEmbeddedFreak
    Apr 15, 2009
  4. mosaic

    About memory leak detection.

    mosaic, Jul 15, 2004, in forum: C Programming
    Replies:
    7
    Views:
    375
    Bernhard
    Jul 16, 2004
  5. Archana

    Memory Leak detection

    Archana, Feb 4, 2008, in forum: C++
    Replies:
    1
    Views:
    342
    Ian Collins
    Feb 4, 2008
Loading...

Share This Page