[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: programming tools



On Tue, Apr 26, 2005 at 09:25:35PM +0200, Joris Huizer wrote:
> Hello,
> 
> I'm wondering, is there a tool (under linux) to find memory leaks? I 
> know of smatch but it doesn't exist under apt (`apt-cache search smatch` 
> doesn't find anything relevant)
> Also, is there a way to find what piece of code is running most of the 
> time in a program?
> 
> Just to try and find some clues about wine's behavior (for the latter, 
> so much X activity sometimes) and out of curiosity
> 
> Thanks,
> 
> regards,
> 
> Joris
As you'll see in a thread I started around the same time, I'm trying
to isolate an apparent memory problem, so I'm interested in this too.
mpatrol is the tool I've been using.  There are lots.  Here are some
I've noticed (many taken from the gnu libstdc++ docs):
     mtrace
     electric fence
     valgrind
     mudflap
     purify (proprietary and $)
        I've used purify on a number of platforms and it works well.
	I've seen mixed reviews of the quality of the Linux product.
     gnu lib C
         MALLOC_CHECK_= 0, 1 or 2 to trace the the malloc function
  
The mpatrol docs refer to some obsolete gcc options, which has me
wondering if mpatrol's getting a bit dated.  Also, my understanding is
that mpatrol only does heap memory problems.

At least in my current program, C++ memory allocation seems to be
layered on top of the traditional libc allocation.  Then again, wine
probably doesn't use C++, so you may not need to worry about that
wrinkle.

In general, I find running a C program through a memory checker tends
to reveal lots of problems with the code, if it hasn't been checked
before.  But maybe I just see unusally sloppy code (mind you, it's not
all mine) :)  I've heard the X windows code is a rich source of such
problems.





Reply to: