1Devel::Gladiator(3)   User Contributed Perl Documentation  Devel::Gladiator(3)
2
3
4

NAME

6       Devel::Gladiator - Walk Perl's arena
7

VERSION

9       version 0.08
10

SYNOPSIS

12         use Devel::Gladiator qw(walk_arena arena_ref_counts arena_table);
13
14         my $all = walk_arena();
15
16         foreach my $sv ( @$all ) {
17             warn "live object: $sv\n";
18         }
19
20         warn arena_table(); # prints counts keyed by class
21
22         # how to spot new entries in the arena after running some code
23         use Devel::Gladiator qw(walk_arena);
24         my %dump1 = map { ("$_" => $_) } @{walk_arena()};
25         # do something
26         my %dump2 = map { $dump1{$_} ? () : ("$_" => $_) } @{walk_arena()};
27         use Devel::Peek; Dump \%dump2;
28

DESCRIPTION

30       Devel::Gladiator iterates Perl's internal memory structures and can be
31       used to enumerate all the currently live SVs.
32
33       This can be used to hunt leaks and to profile memory usage.
34

EXPORTS

36   walk_arena
37       Returns an array reference containing all the live SVs. Note that this
38       will include a reference back to itself, so you should manually clear
39       this array (via "@$arena = ()") when you are done with it, if you don't
40       want to create a memory leak.
41
42   arena_ref_counts
43       Returns a hash keyed by class and reftype of all the live SVs.
44
45       This is a convenient way to find out how many objects of a given class
46       exist at a certain point.
47
48   arena_table
49       Formats a string table based on "arena_ref_counts" suitable for
50       printing.
51

LIMITATIONS

53       This code may not work on perls 5.6.x and 5.8.x if PadWalker is
54       installed.  (Patches gratefully accepted!)
55

SEE ALSO

57       •   Become a hero plumber <http://blog.woobling.org/2009/05/become-
58           hero-plumber.html>
59
60       •   Test::Memory::Cycle
61
62       •   Devel::Cycle
63
64       •   Devel::Refcount
65
66       •   Devel::Leak
67
68       •   Data::Structure::Util
69

SUPPORT

71       Bugs may be submitted through the RT bug tracker
72       <https://rt.cpan.org/Public/Dist/Display.html?Name=Devel-Gladiator> (or
73       bug-Devel-Gladiator@rt.cpan.org <mailto:bug-Devel-
74       Gladiator@rt.cpan.org>).
75

AUTHOR

77       Artur Bergman <sky@apple.com>
78

CONTRIBUTORS

80       •   Karen Etheridge <ether@cpan.org>
81
82       •   יובל קוג'מן (Yuval Kogman) <nothingmuch@woobling.org>
83
84       •   Jesse Luehrs <doy@tozt.net>
85
86       •   Brad Fitzpatrick <brad@danga.com>
87
88       •   mohawk <mohawk2@users.noreply.github.com>
89
90       •   Curtis Brandt <curtisjbrandt@gmail.com>
91
93       This software is copyright (c) 2006 by Artur Bergman.
94
95       This is free software; you can redistribute it and/or modify it under
96       the same terms as the Perl 5 programming language system itself.
97
98
99
100perl v5.38.0                      2023-07-20               Devel::Gladiator(3)
Impressum