Devel::Plumber is a memory leak finder class for C programs, implemented in Perl. It uses GDB to walk internal glibc heap structures, so it can work on either a live process or a core file.
Devel::Plumber treats the C heap of the program under test as a collection of non-overlapping blocks, and classifies them into one of four states.
Free
The block is not allocated.
Leaked
The block is allocated but there are no pointers to any address in it, so the program cannot reach it.
Maybe Leaked
The block is allocated and there are pointers to addresses within it, but no pointers to the start of it. The program might be able to reach it in some unobvious way via those pointers (e.g. using pointer arithmetic), or the pointers may be dangling pointers to earlier generations of blocks. Devel::Plumber cannot tell the difference between these possibilities.
Reached
The block is allocated and there are pointers to the start of the block.
Devel::Plumber proceeds in two main phases. In the first phase, the glibc internal heap structures are walked to discover all the blocks. Unallocated blocks are set to Free state at this time and allocated blocks are initially set to Leaked state. In the second phase, reachable blocks are marked. All the .data and .bss sections in the program (and all loaded shared libraries) are scanned for pointers. If a pointer points to the start of a block, the block is set to Reached state; if it points into a Leaked block, the block is set to Maybe Leaked state. In either case, the block's contents are also scanned for pointers. After the second phase is complete, any blocks still in Leaked state are definitely leaked.
SYNOPSIS
use Devel::Plumber;
my $mario = new Devel::Plumber(binfile => 'myprogram',
pid => 12345);
$mario = new Devel::Plumber(binfile => 'myprogram',
corefile => 'core.12345');
$mario->find_leaks();
$mario->report_leaks();
Product's homepage
Requirements:
· Perl