Identify Heap Leaks
Explore methods to identify and diagnose heap memory leaks in Linux applications by analyzing core dumps using the GDB debugger. Understand how to examine memory sections, compare pmap logs, and detect patterns indicating progressive memory consumption. This lesson guides you through hands-on debugging practices to pinpoint causes of heap leaks in a practical example.
The application App9 was found to consume more and more memory. There were several core memory dumps that were saved at different times with corresponding pmap logs. In this exercise, we’ll try to identify the cause of this memory leak.
Application source code
For reference, here’s the code of this application:
Loading the first core dump
We’ll start with loading the core dump App9.core.2.230:
gdb -c App9.core.2.230 -se App9
The above command will output the following to the terminal: