Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > How to test for memory leaks?

Reply
Thread Tools

How to test for memory leaks?

 
 
p1r0
Guest
Posts: n/a
 
      08-21-2006
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

 
Reply With Quote
 
 
 
 
Phlip
Guest
Posts: n/a
 
      08-21-2006
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!!!


 
Reply With Quote
 
 
 
 
p1r0
Guest
Posts: n/a
 
      08-21-2006

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

 
Reply With Quote
 
miara
Guest
Posts: n/a
 
      08-21-2006
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
 
Reply With Quote
 
defendusa2@yahoo.com
Guest
Posts: n/a
 
      08-21-2006
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/1...rvssoldier.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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
TEST TEST Test...Blah Blah Blah generalbatguano@pacbell.net Computer Support 2 09-15-2006 03:47 AM
TEST TEST Test...Blah Blah Blah Generalbatguano@pacbell.net Computer Support 6 09-13-2006 01:53 AM
TEST TEST TEST Gazwad Computer Support 2 09-05-2003 07:32 PM
test test test test test test test Computer Support 2 07-02-2003 06:02 PM



Advertisments