Normally, running valgrind is a matter of either:
valgrind --tool=memcheck --num-callers=50 --leak-check=yes myprog
valgrind --tool=massif --depth=50 --format=html myprog
Former reports memory leaks and latter generates a postscript graph of the memory usage and a HTML report of the stacktraces leading to them.
However, some programs on the GNOME desktop are hard to get into because they start up automatically. Here are some tips:
nautilus, gnome-panel: These start up from gnome-session. Here is what you need to do:
- Go to the Current Session tab
- Click on the program you want to profile in the list box
- Set Style to Normal (it will be Reset now)
- Click Apply
VincentUntz: It's easier to do gnome-session-remove program-name instead of all those steps.
valgrind program-name &> vg
- To exit the program, hit ctrl+c to abort. It will restart and set itself back to normal
VincentUntz: here again, you should be able to do gnome-session-remove program-name to stop valgrind.
KjartanMaraas: also, if you want to trace both the panel and any panel programs that are loaded when the panel starts, use --trace-children=yes --log-file=/tmp/valgrind - this will create /tmp/valgrind.pidXXX files for all processes that are started by this command.
MatthiasClasen: see http://www.redhat.com/archives/fedora-desktop-list/2004-September/msg00032.html for running a complete session under valgrind
Bonobo type stuff: these are processes started up by Bonobo. You can list these with ps aux | grep oaf-activate | grep -v grep.
Find the .server file. Try locate .server
- You will see something like
<oaf_info> <oaf_server iid="OAFIID:GNOME_SettingsDaemon" type="exe" location="/opt/gnome/lib/control-center-2.0/gnome-settings-daemon"> <oaf_attribute name="repo_ids" type="stringv"> <item value="IDL:Bonobo/Unknown:1.0"/> <item value="IDL:GNOME/SettingsDaemon:1.0"/> </oaf_attribute> </oaf_server> </oaf_info>
You want to take the thing that is in location and make a shell script that looks like this:
exec valgrind /opt/gnome/lib/control-center-2.0/gnome-settings-daemon "$@" &> my-file
Then replace the location with the location of the shell script.
KjartanMaraas: most of these binaries were moved to $prefix/libexec some time ago...
Now killall bonobo-activation-server and also killall gnome-settings-daemon (replace with the program you are looking at, as needed).