Using gdb to find memory leaks in HP Unix
Using gdb to find memory leaks in HP Unix The following gdb commands are used to setup memory leak detection in C++ programs: set heap-check leaks on set heap-check free on set heap-check bounds on set heap-check scramble on To show the leak the following command is used: (gdb) info leaks To view a particular leak from a list of leaks detected use the following: (gdb) info leak <leak number> ( leak number is the relevant number from the leak) It is very important that program be linked with librt.sl shared library to use heap profiling. The following example is using xscAppAdapter as a C++ program to demonstrate memory leak detection. 1) Set Heap Options >>gdb xscAppAdapter.gdb (gdb) set heap-check leaks on (gdb) set heap-check free on (gdb) set heap-check bounds on (gdb) set heap-check scramble on (gdb) b xscAppAdapter::processMessage 2) Set Breakpoint and Run Application and continue once past the breakpoint to process a message and t...