Monitor the memory leak of C program under Linux system

Source: Internet
Author: User
Tags valgrind linux

In Linux under some C language programs, the biggest problem is that there is no good programming IDE, of course, like KDevelop and other tools are quite powerful, but I still used to use the KDevelop tool, because there is not a custom programming IDE, Memory detection is also a big problem with programming programs in Linux.

Does it mean that there is no memory-checking tool that can be used in Linux or, like Valgrind tools, is pretty good. His download address is http://valgrind.org/downloads/current.html#current download a valgrind 3.2.3 (tar.bz2) tool, according to the inside of the readme prompts, This tool can be used to detect memory leaks and memory crossings after installation. This is a no interface of the memory Detection tool, after installation, input Valgrind Ls-l Verify that the tool is working properly (this is the method in the readme, is actually to verify the memory of the LS-L command), if you see a bunch of information that your tool can be used.

When compiling your program, please set the-g parameter, compile it and use the following command to determine the memory leak of your program:

Valgrind--tools=memcheck--leak-check=full Yourprog will see your memory problem in the output information. You can refer to the output information of Valgrind--help about what these parameters mean.

Related Article

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.