1 | #!/opt/bin/perl |
1 | #!/opt/bin/perl |
2 | |
|
|
3 | |
|
|
4 | # very stupid leak checker, checks after some time whether the passed |
|
|
5 | # object is still around and tracks it via Devel::FindRef. |
|
|
6 | sub leakcheck($$) {#d# |
|
|
7 | my ($after, $ref) = @_; |
|
|
8 | |
|
|
9 | use EV;#d# |
|
|
10 | Scalar::Util::weaken $ref; |
|
|
11 | |
|
|
12 | my $w; $w = EV::timer $after, 0, sub { |
|
|
13 | undef $w; |
|
|
14 | return unless $ref; |
|
|
15 | |
|
|
16 | require Devel::FindRef; |
|
|
17 | warn "object $ref still alive after $after seconds:\n" |
|
|
18 | . Devel::FindRef::track ($ref, 30); |
|
|
19 | }; |
|
|
20 | } |
|
|
21 | |
2 | |
22 | =head1 NAME |
3 | =head1 NAME |
23 | |
4 | |
24 | aemp - AnyEvent:MP utility |
5 | aemp - AnyEvent:MP utility |
25 | |
6 | |