Devel::Gladiator(3)
β¨ Devel::Gladiator β¨
okay bestie, so this is the manual page for Devel::Gladiator, a Perl module that literally walks around inside Perl's arena and tells you what's alive in there π
πΈ VERSION πΈ
version 0.08 β yes she's on 0.08, we love a specific number, no cap π
π¦ SYNOPSIS π¦
here's the vibe, copy-paste ready:
use Devel::Gladiator qw(walk_arena arena_ref_counts arena_table);
my $all = walk_arena();
foreach my $sv ( @$all ) {
warn "live object: $sv\n";
}
warn arena_table(); # prints counts keyed by class
# how to spot new entries in the arena after running some code
use Devel::Gladiator qw(walk_arena);
my %dump1 = map { ("$_" => $_) } @{walk_arena()};
# do something
my %dump2 = map { $dump1{$_} ? () : ("$_" => $_) } @{walk_arena()};
use Devel::Peek; Dump \%dump2;
π DESCRIPTION π
so basically, Devel::Gladiator iterates Perl's internal memory structures and it can be used to enumerate all the currently live SVs. every single one. she's thorough like that β¨
and what do you do with that power? two things, iconic behaviour only:
- hunt leaks π
- profile memory usage π
periodt. π
π EXPORTS π
π§ walk_arena
returns an array reference containing all the live SVs. all of them, bestie.
β οΈ huge caveat incoming: this will include a reference back to itself. so when you're done with it you should manually clear this array β like @$arena = () β otherwise you're literally creating a memory leak while hunting for memory leaks π the irony is giving main character energy in the worst way.
π arena_ref_counts
returns a hash keyed by class and reftype of all the live SVs.
this is the convenient little shortcut for finding out how many objects of a given class exist at a certain point in time. lowkey the most useful thing here, fr fr π«Ά
β arena_table
formats a string table based on arena_ref_counts that's suitable for printing. so you can just warn it and stare at your beautiful little table πΈ
π LIMITATIONS π
ngl, this code may not work on perls 5.6.x and 5.8.x if PadWalker is installed.
(and the author says, and I quote: "Patches gratefully accepted!" β so if you fix it, you're a hero π«Ά)
π₯ SEE ALSO π₯
- Become a hero plumber <http://blog.woobling.org/2009/05/become-hero-plumber.html>
- Test::Memory::Cycle
- Devel::Cycle
- Devel::Refcount
- Devel::Leak
- Data::Structure::Util
go read all of these, they're the friend group π¦
π©· SUPPORT π©·
got bugs? don't suffer in silence, bestie. bugs may be submitted through the RT bug tracker <https://rt.cpan.org/Public/Dist/Display.html?Name=Devel-Gladiator> β or you can email bug-Devel-Gladiator@rt.cpan.org <mailto:bug-Devel-Gladiator@rt.cpan.org> π
π€ AUTHOR π€
Artur Bergman <sky@apple.com>
π CONTRIBUTORS π
- Karen Etheridge <ether@cpan.org>
- ΧΧΧΧ Χ§ΧΧ'ΧΧ (Yuval Kogman) <nothingmuch@woobling.org>
- Jesse Luehrs <doy@tozt.net>
- Brad Fitzpatrick <brad@danga.com>
- mohawk <mohawk2@users.noreply.github.com>
- Curtis Brandt <curtisjbrandt@gmail.com>
icons, every single one π
π COPYRIGHT AND LICENCE π
This software is copyright (c) 2006 by Artur Bergman.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
and that's the whole thing, bestie π
this page came to you from perl v5.42.0, dated 2025-07-25, and it's the Devel::Gladiator(3) manpage β now go walk that arena and clear your arrays, i'm begging you ππ«Ά
π¦ where this page comes from
- fedora 43: perl-Devel-Gladiator 0.08-20.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms