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.07
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         my %dump1 = map { ("$_" => $_) } walk_arena();
24         # do something
25         my %dump2 = map { $dump1{$_} ? () : ("$_" => $_) } walk_arena();
26         use Devel::Peek; Dump \%dump2;
27

DESCRIPTION

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

EXPORTS

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

LIMITATIONS

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

SEE ALSO

56           Become a hero plumber <http://blog.woobling.org/2009/05/become-
57           hero-plumber.html> Test::Memory::Cycle Devel::Cycle Devel::Refcount
58           Devel::Leak Data::Structure::Util
59

AUTHOR

61       Artur Bergman <sky@apple.com>
62
64       This software is copyright (c) 2006 by Artur Bergman.
65
66       This is free software; you can redistribute it and/or modify it under
67       the same terms as the Perl 5 programming language system itself.
68

CONTRIBUTORS

70       ·   Karen Etheridge <ether@cpan.org>
71
72       ·   יובל קוג'מן (Yuval Kogman) <nothingmuch@woobling.org>
73
74       ·   Jesse Luehrs <doy@tozt.net>
75
76       ·   Brad Fitzpatrick <brad@danga.com>
77
78       ·   Ed J <mohawk2@users.noreply.github.com>
79
80       ·   Curtis Brandt <curtisjbrandt@gmail.com>
81
82
83
84perl v5.28.1                      2014-10-19               Devel::Gladiator(3)
Impressum