Re: using memprof/Re: Memory Leakage



josh <uzs33d uni-bonn de> writes: 
I would also like to use this very promising looking tool.  Trouble is,
I can't seem to find any documentation.  Can anybody either point me to
some docs, or give me a summary of how to use memprof?


Compile your app (and ideally GLib/GTK also) with debug symbols. Then
run memprof, choose File/Run, and enter the name of your app. Or just 
type "memprof appname" to run it. (Or if your app is linked using
libtool and automake and you're in the source directory, try:
 libtool --mode=execute memprof ./appname
which will let you use memprof without installing the app.)

At any time _while the app is running_ click the "profile" button to
get a profile of memory usage and the "leaks" button to scan for
leaks. The results appear in the profile/leaks tabs. If the backtraces
contain lots of ??? then you don't have debug symbols for some code
you're profiling.  If the backtraces seem sort of bogus, there was a
bug in (I think) the C library that caused that. Or it may have been
in libbfd. Anyway, some system library.

Note that memprof detects allocated memory that the app/library no
longer has a pointer to. So if you have an app that keeps pointers to
a bunch of stuff it doesn't need pointers to, that isn't considered a
leak, just egregiously large memory usage. (You can probably use the
profile feature to detect that.)

In the Profile tab, "self" means memory allocated by the function
itself, "Total" means memory allocated by the function and all
functions that the function calls. "Children" is the list of functions
it calls, and "callers" is the list of functions that called it.

In the Leaks tab, the first pane is the list of leaked memory blocks
with their size, address, and the function that allocated the memory;
stack trace is the stack trace of the call to the function that
allocated the memory, so you can see in what context the memory was
allocated.

Havoc

 




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