https://github.com/mons/dash-leak
Track memory allocation
https://github.com/mons/dash-leak
Last synced: 10 months ago
JSON representation
Track memory allocation
- Host: GitHub
- URL: https://github.com/mons/dash-leak
- Owner: Mons
- License: other
- Created: 2010-02-26T22:51:28.000Z (over 16 years ago)
- Default Branch: master
- Last Pushed: 2010-10-19T12:11:54.000Z (over 15 years ago)
- Last Synced: 2023-03-10T20:33:09.439Z (over 3 years ago)
- Language: Perl
- Homepage: http://search.cpan.org/dist/Dash-Leak
- Size: 279 KB
- Stars: 4
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README
- Changelog: Changes
- License: LICENSE
Awesome Lists containing this project
README
NAME
Dash::Leak - Track memory allocation
SYNOPSIS
Quick summary of what the module does.
BEGIN {
# enables operation of Dash::Leak, leaksz is a nop without this
$ENV{DEBUG_MEM} = 1;
}
use Dash::Leak;
{
leaksz "block label";
# some code, that may leak
}
# If your code leaked, you'll be noticed about change
# of process vsize after leaving block
leaksz "tests begin";
some_operation($arg);
leaksz "some_operation", sub {
warn sprintf "We leaked after some_operation($arg) by %+d kilobytes;", shift
};
another_operation();
leaksz "another_operation";
# ...
use Dash::Leak sub { ... }; # Will call this cb for every alloc, instead of warn
EXPORT
Export of this module is "virtual", by using Devel::Declare. When
$ENV{DEBUG_MEM} is true, it will work, when false, this opcodes will be
ignored, like with "leaksz ... if 0";
FUNCTIONS
leaksz $label, [$cb->($delta)]
Starts tracking current block. If something changed since last note,
notice will be warned. If callback is passed, it will be invoked instead
of warn.
ACKNOWLEDGEMENTS
* Thanks to knevgen () for linux version
patch
AUTHOR
Mons Anderson, ""
COPYRIGHT & LICENSE
Copyright 2010 Mons Anderson, all rights reserved.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.