5 use base qw(DynaLoader);
15 Devel::Leak - Utility for looking for perl objects that are not reclaimed.
22 my $count = Devel::Leak::NoteSV($handle);
24 ... code that may leak
26 Devel::Leak::CheckSV($handle);
30 Devel::Leak has two functions C<NoteSV> and C<CheckSV>.
32 C<NoteSV> walks the perl internal table of allocated SVs (scalar values) - (which
33 actually contains arrays and hashes too), and records their addresses in a
34 table. It returns a count of these "things", and stores a pointer to the
35 table (which is obtained from the heap using malloc()) in its argument.
37 C<CheckSV> is passed argument which holds a pointer to a table created by
38 C<NoteSV>. It re-walks the perl-internals and calls sv_dump() for any "things"
39 which did not exist when C<NoteSV> was called. It returns a count of the number
40 of "things" now allocated.
44 If new "things" I<have> been created, C<CheckSV> may (also) report additional
45 "things" which are allocated by the sv_dump() code.
49 Note that perls older than 5.6.0 need to be built with -DDEBUGGING
50 for sv_dump() to print anything, but counts are valid in any perl.
54 This little utility module was part of Tk until the variable renaming
55 in perl5.005 made it clear that Tk had no business knowing this much
56 about the perl internals.
60 Nick Ing-Simmons <nick@ni-s.u-net.com>