Test::LeakTrace::JA(3p)

NAME
Test::LeakTrace::JA - XXXXXXXXXXX

VERSION
This document describes Test::LeakTrace version 0.10.

SYNOPSIS
        use Test::LeakTrace;

        # simple report
        leaktrace{
                # ...
        };

        # verbose output
        leaktrace{
                # ...
        } -verbose;

        # with callback
        leaktrace{
                # ...
        } sub {
                my($ref, $file, $line) = @_;
                warn "leaked $ref from $file line\n";
        };

        my @refs = leaked_refs{
                # ...
        };
        my @info = leaked_info{
                # ...
        };

        my $count = leaked_count{
                # ...
        };

        # standard test interface
        use Test::LeakTrace;

        no_leaks_ok{
                # ...
        } "description";

        leaks_cmp_ok{
                # ...
        } '<', 10;

DESCRIPTION
PerlXGCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

"Test::LeakTrce"XXXXXXXXXXXXXXXXXXXXXXXXXXXX"Test::Builder"XXXXXXXXXXXXXXXXXXXXXXXXPerlXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXSVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXPerlXXXXXXXXXXXXXXXXXSXXXXXXPerlXXXXXXXXXXXXXXXXXXXXXXXXXXX

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXPerlXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

INTERFACE

  Exported functions
"leaked_info { BLOCK }"

BLOCKXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"[$ref, $file, $line]"XXXXXXXXXXXX

XXXXXXXXPerlXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXPerlXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXPerlXXXXXXXXXXXXXXXXXXXXX"Data::Dumper"XXXXXXXXXXXXXXXX

"leaked_refs { BLOCK }"

BLOCKXXXXXXXXXXSVXXXXXXXXXXXXXXXXX

"map{ $_->[0] } leaked_info{ BLOCK }"XXXXXXXXXXXXXX

"leaked_count { BLOCK }"

BLOCKXXXXXXXXXXSVXXXXXXXXXXXXXXXX

"leaked_info()"X"leaked_refs()"XXXXXXXXXXXXXXXXXXXXX "leaked_count()"XXXXXXXXXXXXXXX

"leaktrace { BLOCK } ?($mode | \&callback)"

BLOCKXXXXXXXXXXXXXXXXXXX*STDERRXXXXXXX

XXXXXXXXXX$modeXXXXXXXXXXXXXX XXXXX$modeXXXXXXXXX

-simple
    XXXXXXXXXXXXXXXXXSVXXXXXXXXXXXXXXXXXXXXXXXX

-sv_dump
    -simpleXXXXX"sv_dump()"XSVXXXXXXXXXXX XXXX"Devel::Peek::Dump()"XXXXXXXXXXX

-lines
    -simpleXXXXXXXXXXXXXXXXXXXXXXXXXXXX

-verbose
    -simpleX-sv_dumpX-linesXXXXXXXXXX

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX \&callbackXXXXXXSVXXXXXXXXXXXXXXXXXXSVXXXXXXXXXXXXXXXXXX3XXXX

"no_leaks_ok { BLOCK } ?$description"

BLOCKXXXXXXXXXXXXXXXXXXX XXX"Test::Builder"XXXXXXXXXXXX

XXXBLOCKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

"leaks_cmp_ok { BLOCK } $cmp_op, $count, ?$description"

BLOCKXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXX"Test::Builder"XXXXXXXXXXXX

XXXBLOCKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  Script interface
"Devel::LeakTrace"XXXXXXXXXXXXXXXXXXXX"Test::LeakTrace::Script"XXXXXXXX"use Test::LeakTrace::Script"XXXXXX"leaktrace()"XXXXXX

        $ TEST_LEAKTRACE=-sv_dump perl -MTest::LeakTrace::Script script.pl
        $ perl -MTest::LeakTrace::Script=-verbose script.pl

        #!perl
        # ...

        use Test::LeakTrace::Script sub{
                my($ref, $file, $line) = @_;
                # ...
        };

        # ...

EXAMPLES

  Testing modules
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

        #!perl -w
        use strict;
        use constant HAS_LEAKTRACE => eval{ require Test::LeakTrace };
        use Test::More HAS_LEAKTRACE ? (tests => 1) : (skip_all => 'require Test::LeakTrace');
        use Test::LeakTrace;

        use Some::Module;

        leaks_cmp_ok{
                my $o = Some::Module->new();
                $o->something();
                $o->something_else();
        } '<', 1;

GUTS
"Test::LeakTrace"XXXXXXXXXXXXXXXXXXXPerlXXXXXSVXXXXXXXXXXXXXXXXXXXXXXsv.cXXXXXXXXXX XXXXXXXXXsv.cXXX"S_visit()"XXXXXXXXXXXXXXXXXXXX

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXSVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXSVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXSVXXXXXXXXXXXXXXXXXXXXXXXXXXXSVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXPerlXXXXXXXXXXXXXXXXXX

        my %used_sv;
        foreach my $sv(@ARENA){
                $used_sv{$sv}++;
        }
        $block->();

        my @leaked
        foreach my $sv(@ARENA){
                if(not exists $used_sv{$sv}){
                        push @leaked, $sv;
                }
        }
        say 'leaked count: ', scalar @leaked;

XXXXXSVXXXXXXXXXXXXXXXXXXXX"leaked_refs()"X"leaked_count()"XXXXXXXXXXXXXXSVXXXXXXXXXXXXX

XXXXXXXXXSVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXPerl 5.10XXXXSVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"-DDEBUG_LEAKING_SCALARS"XXXXPerlXXXXXXXXXXXXXXX

XXXX"Test::LeakTrace"XXXXXXX"PL_runops"XXXXXXPerl VMXOPXXXXXXXX1XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX1XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXPerlXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

XXX"no_leaks_ok()"XXXXXXXXXXXX"leaked_count()"XXXXXXSVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"leaktrace()"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

DEPENDENCIES
Perl 5.8.1 or later, and a C compiler.

CAVEATS
"Test::LeakTrace"X"Devel::Cover"XXXXXXXXXXXXXXXX XXXXXX"Devel::Cover"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

BUGS
No bugs have been reported.

Please report any bugs or feature requests to the author.

SEE ALSO
Devel::LeakTrace.

Devel::LeakTrace::Fast.

Test::TraceObject.

Test::Weak.

For guts:

perlguts.

perlhack.

sv.c.

AUTHOR
Goro Fuji <gfuji(at)cpan.org>.

LICENSE AND COPYRIGHT
Copyright (c) 2009, Goro Fuji. Some rights reserved.

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