Valgrind: detect memory leak and threading bugs

Source: Internet
Author: User
Tags valgrind

Valgrind is a GPL 'd System for debugging and profiling Linux programs. with valgrind's tool suite you can automatically detect into memory management and threading bugs, avoiding hours of frustrating bug-hunting, making your programs more stable. you can also perform detailed profiling to help speed up your programs.

Why shoshould you use valgrind?
  • Valgrind will save you hours of debugging time. with valgrind tools you can automatically detect into memory management and threading bugs. this gives you confidence that your programs are free of charge Common Bugs, some of which wocould take hours to find manually, or never be found at all. you can find and eliminate bugs before they become a problem.
  • Valgrind can help you speed up your programs. With valgrind tools you can also perform very detailed profiling to help find bottlenecks in your programs.
  • Valgrind is free. free-as-in-speech: You can download it, read the source code, make modifications, and pass them on, all within the limits of the gnu gpl. and free-as-in-beer: We aren't charging for it.
  • Valgrind runs on several popular platforms, such as x86/Linux, amd64/Linux and ppc32/Linux. valgrind works with all the major Linux distributions, including red hat, Suse, Debian, Gentoo, slackware, Mandrake, etc.
  • Valgrind is easy to use. valgrind uses dynamic binary instrumentation, so you don't need to modify, recompile or relink your applications. Just prefix your command line with valgrind and everything works.
  • Valgrind is not a toy. valgrind is first and foremost a debugging and profiling system for large, complex programs. we have had feedback from users working on projects with up to 25 million lines of code. it has been used on projects of all sizes, from single-user personal projects, to projects with hundreds of programmers.
  • Valgrind is suitable for any type of software. valgrind has been used with desktop applications, libraries, databases, games, Web browsers, network servers, distributed control systems, virtual reality frameworks, transaction servers, compilers, interpreters, virtual machines, telecom applications, embedded software, medical imaging, Scientific Programs, signal processing programs, video/audio programs, business intelligence software, financial/banking software, operating system daemons, etc, etc. see a list of projects using valgrind.
  • Valgrind is widely used. valgrind has been used by thousands of programmers should ss the world. We have received feedback from users in over 30 countries.
  • Valgrind works with programs written in any language. because valgrind works directly with program binaries, it works with programs written in any programming language, be they compiled, just-in-time compiled, or interpreted. the valgrind tools are largely aimed at programs written in C and C ++, because programs written in these programming ages tend to have the most bugs! But it can, for example, be used to debug and profile systems written in a mixture of ages. valgrind has been used on programs written partly or entirely in C, C ++, Java, Perl, Python, assembly code, Fortran, Ada, and other others.
  • Valgrind gives 100% coverage of user-Space Code, even within system libraries. You can even use valgrind on programs for which you don't have the source code.
  • Valgrind is extensible. anyone can write powerful new tools that add arbitrary instrumentation to programs. this is much easier than writing such tools from scratch. this makes valgrind ideal for experimenting with new kinds of program analysis tools. it has been used for research purposes by people at the following Universities: Cambridge, MIT, UC Berkeley, UC Santa Barbara, Carnegie Mellon, Cornell, University of New Mexico, w.alian National University, university of Melbourne, tu Muenchen (Munich) and Graz University of Technology.
  • Valgrind is actively maintained. the valgrind developers are constantly working to fix bugs, improve valgrind, and ensure it works as new Linux distributions and libraries come out. there are also mailing lists you can subscribe to, and contact if you're having problems.

So what's the catch? The main one is that programs run significantly more slowly under valgrind. depending on which tool you use, the slowdown factor can range from 5--100. this slowdown is similar to that of similar debugging and profiling tools. but since you don't have to use valgrind all the time, this usually isn' t too much of a problem. the hours you'll save debugging will more than make up for it.

When should you use valgrind?

It depends on your exact needs. Here are some examples of when people use valgrind's bug-detecting tools.

  • All the time. For small programs with short run-times, when developing you can always run the program under a valgrind tool (usually memcheck), knowing that memory bugs will be found immediately.
  • In automatic testing. By using valgrind tools in your automatic unit, integration, system, or regression test, you can be confident no code will be unchecked.
  • After big changes. To ensure new bugs haven't been introduced in the new Code.
  • When a bug occurs. get instant feedback about what the bug is, where it occurred, and why.
  • When a bug is suspected. Is your program behaving oddly? Use a valgrind tool to discover if a bug is the cause.
  • Before a release. To give you confidence that your new release is as stable and bug-free as possible.
  • As for valgrind's profiling tools, use those whenever you want information about how your program is spending its time, or you want to speed it up.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.