NAME

Devel::MemoryTrace::Light - Print a message when your program grows in memory

VERSION

version .02

SYNOPSIS

perl -d:MemoryTrace::Light Program

DESCRIPTION

This is an Alpha release! More features to come.

Prints out a message when your program grows in memory containing the package, file, line, and number of bytes (resident set size) your program increased. For example, if your program looked like this:

#!/usr/bin/perl

use strict;
use warnings;

my @arr;
$arr[4096] = 'hello';

Then the output will look like:

>> init, 0 (0) used 8192 bytes
>> main, ex.pl (7) used 20480 bytes

RUN-TIME CONTROL OF TRACING

If you would like to override the default behavior of printing to STDOUT whenever the program size increases, you may provide your own callback method.

set_callback(\&somefunc)

Causes \&somefunc to be called whenever the debugger detects an increase in memory size. \&somefunc should accept 4 arguments:

  • $pkg

  • $file

  • $line

  • $bytes

restore_callback()

Restores the default callback.

OS SUPPORT

Currently works on FreeBSD, Linux, and anywhere else GTop is supported.

On FreeBSD, installing this module will install BSD::Process unless GTop is already installed. BSD::Process will be preferred if both modules are on the system.

BUGS

Please report any bugs (or feature requests) through http://rt.cpan.org/.

AUTHOR

Matthew Horsfall (alh) - <WolfSage@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2011 by Matthew Horsfall.

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