NAME
Test::Memory::Cycle - Check for memory leaks and circular memory references
VERSION
Version 1.00
SYNOPSIS
Perl's garbage collection has one big problem: Circular references can't get cleaned up. A circular reference can be as simple as two objects 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.
FUNCTIONS
memory_cycle_ok( $object, $msg )
Checks that $object doesn't have any circular memory references.
memory_cycle_exists( $object, $msg )
Checks that $object does have any circular memory references.
AUTHOR
Written by Andy Lester, <andy@petdance.com>
.
COPYRIGHT
Copyright 2004, Andy Lester, All Rights Reserved.
You may use, modify, and distribute this package under the same terms as Perl itself.