12.07.2015 Views

Red Hat Enterprise Linux 5 Administration Unleashed

Red Hat Enterprise Linux 5 Administration Unleashed

Red Hat Enterprise Linux 5 Administration Unleashed

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Valgrind 459determine what processes are using the most memory on a system. This information canthen be passed on to a development team or, if possible, the program can be replaced byone that requires less memory if necessary. Valgrind currently only works on the followingarchitectures: x86, x86_64, ppc32, and ppc64.To use Valgrind, start by installing the valgrind RPM package. Instructions for installingsoftware can be found in Chapter 3, “Operating System Updates.”Valgrind includes the following tools:. Memcheck: Memory debugging tool. Detects errors in memory management as theyoccur, giving the source code file and line number of the erroneous code along witha stack trace of functions leading up to that line of code. When using Memcheck,programs run 10 to 30 times slower than usual.. Massif: Heap profiler. Takes snapshots of the heap and generates a graph to showheap usage over time. Also shows the program parts that allocate the most memory.When using Massif, programs run 20 times slower than usual.. Cachegrind: Cache profiler. Identifies cache misses by simulating the processor’scache. When using Cachegrind, programs run 20 to 100 times slower than usual.. Callgrind: Extension of Cachegrind. Provides all the information of Cachegrind plusdata about callgraphs.. Helgrind: Thread debugger. Detects memory locations that are used by more thanone thread.22For each program to be debugged or profiled by Valgrind, you will need to install theassociated debuginfo package. Again, these debuginfo packages can be downloaded fromthe ftp.redhat.com FTP server using anonymous login. If you are debugging or profiling aC or C++ program not distributed as a <strong>Red</strong> <strong>Hat</strong> <strong>Enterprise</strong> <strong>Linux</strong> RPM package, debuginformation can be compiled with the -g argument to gcc.The valgrind executable is used to invoke each of these tools with the following syntax:valgrind [options] The Memcheck tool is used by default if no tool is specified. To use a different tool, usethe --tool= option:valgrind --tool= The Valgrind program has options available for it, and each tool has specialized options aswell. Refer to the Valgrind man page with the man valgrind command for the mostupdated list of options.NOTEBecause Valgrind is still under development, refer to www.valgrind.org for instructionson how to read the output, detailed documentation on how each of the tools work, andfor updates to the tools.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!