The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Devel::DumpSizes - Dump the name and size in bytes (in increasing order) of variables that are available at a give point in a script.

SYNOPSIS

use Devel::DumpSizes qw/dump_sizes/;

&Devel::DumpSizes::dump_sizes();

Or,

&Devel::DumpSizes::dump_sizes("/path/of/filename-to-dump-output");

This will print the name of each variable and its size. The name and size are seperated by a '->'

Variable name -> Size in bytes

EXPORTS

Exports one subroutine by default:

dump_sizes

DESCRIPTION

This module allows us to print the names and sizes of variables that are available at a give point in a script.

This module was written while debugging a huge long running script. The main use being to understand how variable sizes were fluctuating during script execution. It uses PadWalker and Devel::Symdump to get the variables. It uses Devel::Size to report the size of each variable.

METHODS

dump_sizes

Usage: &Devel::DumpSizes::dump_sizes();

Or

Usage: &Devel::DumpSizes::dump_sizes("/path/of/filename-to-dump-output");

This method accepts one optional parameter that will be used to create the file where the output is dumped.

If parameter is given then two files will be create. One will have extension .my and will contain my variables. The second file will have extension .ol and will contain our/local variables. If no filename is given output is printed on STDOUT.

As of now, the output is sectioned by printing the following at the start:

        1. either of 'my' or 'our/local' to specify the kind of variables being reported.

        2. output of time().

        3. If possible, subroutine name/line number as returned by caller (perldoc -f caller).

All sizes are in Bytes as returned by Devel::Size. I plan to have more information reported in newer versions.

CAVEATS

  • The limitations of Devel::Size apply to this module.

BUGS

AUTHOR

Gautam Chekuri gautam.chekuri@gmail.com

COPYRIGHT

Copyright (C) 2006 Chekuri Gatuam

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.