1Cycle(3) User Contributed Perl Documentation Cycle(3)
2
3
4
6 Test::Memory::Cycle - Check for memory leaks and circular memory
7 references
8
10 Version 1.04
11
13 Perl's garbage collection has one big problem: Circular references
14 can't get cleaned up. A circular reference can be as simple as two
15 reference that refer to each other:
16
17 my $mom = {
18 name => "Marilyn Lester",
19 };
20
21 my $me = {
22 name => "Andy Lester",
23 mother => $mom,
24 };
25 $mom->{son} = $me;
26
27 "Test::Memory::Cycle" is built on top of "Devel::Cycle" to give you an
28 easy way to check for these circular references.
29
30 use Test::Memory::Cycle;
31
32 my $object = new MyObject;
33 # Do stuff with the object.
34 memory_cycle_ok( $object );
35
36 You can also use "memory_cycle_exists()" to make sure that you have a
37 cycle where you expect to have one.
38
40 "memory_cycle_ok( $reference, $msg )"
41 Checks that $reference doesn't have any circular memory references.
42
43 "memory_cycle_exists( $reference, $msg )"
44 Checks that $reference does have any circular memory references.
45
46 "weakened_memory_cycle_ok( $reference, $msg )"
47 Checks that $reference doesn't have any circular memory references, but
48 unlike "memory_cycle_ok" this will also check for weakened cycles
49 produced with Scalar::Util's "weaken".
50
51 "weakened_memory_cycle_exists( $reference, $msg )"
52 Checks that $reference does have any circular memory references, but
53 unlike "memory_cycle_exists" this will also check for weakened cycles
54 produced with Scalar::Util's "weaken".
55
57 Written by Andy Lester, "<andy @ petdance.com>".
58
60 Please report any bugs or feature requests to "bug-test-memory-cycle at
61 rt.cpan.org", or through the web interface at
62 http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test-Memory-Cycle
63 <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test-Memory-Cycle>. I
64 will be notified, and then you'll automatically be notified of progress
65 on your bug as I make changes.
66
68 You can find documentation for this module with the perldoc command.
69
70 perldoc Test::Memory::Cycle
71
72 You can also look for information at:
73
74 · AnnoCPAN: Annotated CPAN documentation
75
76 http://annocpan.org/dist/Test-Memory-Cycle
77 <http://annocpan.org/dist/Test-Memory-Cycle>
78
79 · CPAN Ratings
80
81 http://cpanratings.perl.org/d/Test-Memory-Cycle
82 <http://cpanratings.perl.org/d/Test-Memory-Cycle>
83
84 · RT: CPAN's request tracker
85
86 http://rt.cpan.org/NoAuth/Bugs.html?Dist=Test-Memory-Cycle
87 <http://rt.cpan.org/NoAuth/Bugs.html?Dist=Test-Memory-Cycle>
88
89 · Search CPAN
90
91 http://search.cpan.org/dist/Test-Memory-Cycle
92 <http://search.cpan.org/dist/Test-Memory-Cycle>
93
95 Thanks to the contributions of Stevan Little, and to Lincoln Stein for
96 writing Devel::Cycle.
97
99 Copyright 2006, Andy Lester, All Rights Reserved.
100
101 You may use, modify, and distribute this package under the same terms
102 as Perl itself.
103
104
105
106perl v5.12.0 2006-08-07 Cycle(3)