Cycle(3)
β¨ Cycle(3) β Test::Memory::Cycle β¨
okay bestie, so this is the Test::Memory::Cycle page from the User Contributed Perl Documentation (that's the manual name, cute right?) and it's literally about catching memory leaks and circular memory references π
πΈ VERSION πΈ
Version 1.06 β she's vintage, she's stable, she's iconic π
π¦ SYNOPSIS π¦
ngl, Perl's garbage collection has one big problem: circular references can't get cleaned up. π And 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;
look at them, mother and son, holding onto each other forever π that's the cycle.
Test::Memory::Cycle is built on top of Devel::Cycle to give you an easy way to check for these circular references. slay.
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 do have a cycle where you expect to have one π
π FUNCTIONS π
memory_cycle_ok( $reference, $msg )
Checks that $reference doesn't have any circular memory references. vibe check: passed β
memory_cycle_exists( $reference, $msg )
Checks that $reference does have any circular memory references. yes bestie, we're confirming the cycle is there π
weakened_memory_cycle_ok( $reference, $msg )
Checks that $reference doesn't have any circular memory references β but unlike memory_cycle_ok, this one will also check for weakened cycles produced with Scalar::Util's weaken. she goes deeper π
weakened_memory_cycle_exists( $reference, $msg )
Checks that $reference does have any circular memory references β but unlike memory_cycle_exists, this one will also check for weakened cycles produced with Scalar::Util's weaken. same energy, extra sauce π«Ά
π AUTHOR π
Written by Andy Lester, <andy @ petdance.com>. we stan π«‘
π BUGS π
Please report any bugs or feature requests to bug-test-memory-cycle at rt.cpan.org, or through the web interface at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test-Memory-Cycle>. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. teamwork fr fr π€
π 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. absolute legends, both of them β
π COPYRIGHT π
Copyright 2003-2016 Andy Lester.
This program is free software; you can redistribute it and/or modify it under the terms of the Artistic License v2.0.
See <http://www.perlfoundation.org/artistic_license_2_0> or the LICENSE file that comes with the Test::Memory::Cycle distribution.
ok that's the whole page bestie, no notes π
and just so you have the receipts β this was perl v5.42.0, dated 2016-04-13, filed under Cycle(3). mwah π
π¦ where this page comes from
- opensuse-leap 16.0: perl-Test-Memory-Cycle 1.06-160000.2.2 Β· Artistic-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms