T. Boddy “Introducing CHAP: A program to clarify dynamic memory usage in un-instrumented cores"
Channel: CppNow
Date: 06/06/2017

http://cppnow.org
—
Presentation Slides, PDFs, Source Code and other presenter materials are available at: https://github.com/boostcon/cppnow_presentations_2017
—
Traditionally, memory usage analysis and memory leak analysis for C and C++ programs involve instrumenting either source code or binary code before running it through a series of tests. Such an approach, depending on how aggressively the code is instrumented, can result in false leak reports, if the code is not sufficiently instrumented to completely understand whether allocations are still in use, or can distort the timing so much that it is not practical to run on a regular basis. What is worse, if the memory usage of interest happened using code that was not instrumented, it may not be practical to reproduce the problem, for example due to dependence on some obscure code path or on some test that is expensive to run.  One other limitation of instrumentation is that it often changes the algorithm itself, and in doing so makes cases where the memory growth is due to allocator-specific behavior less clear to analyze.

At VMware I have developed a tool, now called CHAP but until very recently called ah64, that avoids these issues by analyzing un-instrumented core files, either live cores or cores from crashes, for leaks and memory usage and corruption. It does not report any false leaks and is sufficiently reliable that we run it in an automated way to catch leaks before they are checked in to our code base. We also use it regularly to understand memory growth issues and cases of memory corruption. In this talk I will discuss how the tool works and how to use it to address the use cases described earlier in this paragraph. 

VMware has now made this available as open source at http://github.com/vmware/chap. At present it is working only for Linux ELF cores generated with programs that use glibc malloc.  There was prototyped support for at least one other allocator, but that prototype cannot be made available as open source without permission from the owners of that allocator. Some expected areas of enhancement for CHAP are likely to include support for other open source allocators, such as tcmalloc and jemalloc, support for other dump formats, better scripting, and use of DWARF information to make usage analysis more precise. 
— 
I have been working with C since 1984 or so and with C++ since 2005. My current focus at VMware is writing debugging tools including memory analyzers, deadlock analyzers and python extensions to gdb, and sometimes using these tools or offering advice on how to do so.

On April 19, 2017, a tool that I wrote that was originally called ah64 and is the subject of my talk at Aspen in 2017, was renamed to CHAP and published at https:://github.com/vmware/chap
—
Videos Filmed & Edited by Bash Films: http://www.BashFilms.com
---

*--*

---