1Leak(3) User Contributed Perl Documentation Leak(3)
2
3
4
6 Devel::Leak - Utility for looking for perl objects that are not
7 reclaimed.
8
10 use Devel::Leak;
11 ... setup code
12
13 my $count = Devel::Leak::NoteSV($handle);
14
15 ... code that may leak
16
17 Devel::Leak::CheckSV($handle);
18
20 Devel::Leak has two functions "NoteSV" and "CheckSV".
21
22 "NoteSV" walks the perl internal table of allocated SVs (scalar values)
23 - (which actually contains arrays and hashes too), and records their
24 addresses in a table. It returns a count of these "things", and stores
25 a pointer to the table (which is obtained from the heap using malloc())
26 in its argument.
27
28 "CheckSV" is passed argument which holds a pointer to a table created
29 by "NoteSV". It re-walks the perl-internals and calls sv_dump() for any
30 "things" which did not exist when "NoteSV" was called. It returns a
31 count of the number of "things" now allocated.
32
34 Note that you need a perl built with -DDEBUGGING for sv_dump() to print
35 anything, but counts are valid in any perl.
36
37 If new "things" have been created, "CheckSV" may (also) report
38 additional "things" which are allocated by the sv_dump() code.
39
41 This little utility module was part of Tk until the variable renaming
42 in perl5.005 made it clear that Tk had no business knowing this much
43 about the perl internals.
44
46 Nick Ing-Simmons <nick@ni-s.u-net.com>
47
48
49
50perl v5.36.0 2023-01-20 Leak(3)