Linux C program memory leakage detection

Source: Internet
Author: User
Tags valgrind
Linux C program memory leakage detection-Linux general technology-Linux programming and kernel information, the following is a detailed description. In linux, the biggest problem with some C language programs is that there is no good programming IDE. Of course, kdevelop and other tools are quite powerful, but I am still used to using kdevelop tools, since there is no familiar programming IDE, memory detection has become a major problem of programming in linux.

Doesn't it mean that there is no memory check tool that can be used in linux? It's not like valgrind. He is the http://valgrind.org/downloads/current.html#current to download a valgrind 3.2.3 (tar.bz2) tool, according to the README prompt inside, after installation can use this tool to detect memory leakage and memory out-of-bounds and so on. This is a memory detection tool without interface. After installation, enter valgrind ls-l to verify whether the tool works properly (this is the method in README, in fact, it is used to verify the memory detection of the ls-l command. If you see a bunch of information, your tool can be used.

When compiling your program, set the-g parameter. After compilation, use the following command to determine whether your program has memory leakage:

Valgrind -- tools = memcheck -- leak-check = full yourProg will see your memory problems in the output information. For more information about the meaning of these parameters, see the output information of valgrind -- help.
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.