Test::Memory::Cycle3pm
Check for memory leaks and circular memory references
Usage
Perl's garbage collection has one big problem: Circular references can't get cleaned up. A circular reference can be as simple as two references that refer to each other:
my $mom = {name => "Marilyn Lester",};my $me = {name => "Andy Lester",mother => $mom,};$mom->{son} = $me;
"Test::Memory::Cycle" is built on top of "Devel::Cycle" to give you an easy way to check for these circular references.
use Test::Memory::Cycle;my $object = new MyObject;# Do stuff with the object.memory_cycle_ok( $object );
You can also use memory_cycle_exists() to make sure that you have a cycle where you expect to have one.
Version
Version 1.06
Functions
"memory_cycle_ok( $reference, $msg )"
Checks that $reference doesn't have any circular memory references.
"memory_cycle_exists( $reference, $msg )"
Checks that $reference does have any circular memory references.
"weakened_memory_cycle_ok( $reference, $msg )"
Checks that $reference doesn't have any circular memory references, but unlike "memory_cycle_ok" this will also check for weakened cycles produced with Scalar::Util's "weaken".
"weakened_memory_cycle_exists( $reference, $msg )"
Checks that $reference does have any circular memory references, but unlike "memory_cycle_exists" this will also check for weakened cycles produced with Scalar::Util's "weaken".
Support
You can find documentation for this module with the perldoc command.
perldoc Test::Memory::Cycle
You can also look for information at:
- •
-
AnnoCPAN: Annotated CPAN documentation
<http://annocpan.org/dist/Test-Memory-Cycle>
- •
-
CPAN Ratings
<http://cpanratings.perl.org/d/Test-Memory-Cycle>
- •
-
RT: CPAN's request tracker
<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Test-Memory-Cycle>
- •
-
Search CPAN
<http://search.cpan.org/dist/Test-Memory-Cycle>
Acknowledgements
Thanks to the contributions of Stevan Little, and to Lincoln Stein for writing Devel::Cycle.
Releases
9 releases since Debian 6.0 (Squeeze); the text changed 3 times.