Use of Valgrind

Source: Internet
Author: User
Tags valgrind

Valgrind is a GPL software used for memory debugging and code analysis in LINUX systems. It can monitor memory usage in code, such as malloc and free in c, new and delete in c ++.
Valgrind can be used to check bugs in memory and threads.
Valgrind contains many tools, such as memcheck, cachegrind, helgrind, callgrind, and massif.
Memcheck mainly checks the following errors
1. Use uninitialized memory
2. Use the released memory
3. Use memory space that exceeds malloc allocation
4. Illegal stack access
5. Whether the applied space has been released
6. Does malloc/free match with new/delete?
7. src/dst overlapping
Functions of cachegrind
It simulates the cache of the CPU and can accurately point out the memory loss and hit of the program. If needed, it can also provide us with the number of cache losses.
Helgrind analyzes problems in multiple threads, such as competition and locking.
Massif stack Analyzer
It can measure the memory used by the program in the stack area. It tells us the heap management block, stack size, and heap block size.
Use of valgrind
Related options for Memcheck:
-Leak-check = no | summary | what is the leak details required for full? [Summary]
-Leak-resolution = low | med | high how much bt merging in leak check [low]
-Show-reachable = no | yes show reachable blocks in leak check? [No]

Author: "dancer blog"

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.