Skip Menu |
 

This queue is for tickets about the Devel-Leak-Object CPAN distribution.

Report information
The Basics
Id: 72908
Status: open
Priority: 0/
Queue: Devel-Leak-Object

People
Owner: Nobody in particular
Requestors: 'spro^^*%*^6ut# [...] &$%*c
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: Wishlist: callbacks
Download (untitled) / with headers
text/plain 338b
It would be nice if Devel::Leak::Object allowed me to specify a callback function to be called for each object. The attached file is the little hack I applied for my debugging needs. Something more general would be nice, though. (On the other hand, if you could provide Devel::Cycle output as an option, that would be very useful.)
Subject: open_WfZ6fzYi.txt
Download open_WfZ6fzYi.txt
text/plain 1021b
--- /Library/Perl/5.10.1/Devel/Leak/Object.pm 2010-06-15 20:43:34.000000000 -0700 +++ Devel/Leak/Object.pm 2011-12-02 14:37:10.000000000 -0800 @@ -79,7 +79,9 @@ ($package, $srcfile, $srcline, $subroutine) = ($next_package, $next_srcfile, $next_srcline, $next_subroutine); } } - $TRACKED{$address} = { class => $class, file => $srcfile, line => $srcline, package=>$package, subroutine=>$subroutine }; + Scalar::Util::weaken(( + $TRACKED{$address} = { class => $class, file => $srcfile, line => $srcline, package=>$package, subroutine=>$subroutine, object => $object } + )->{object}); # If needed, initialise the new class unless ( $DESTROY_STUBBED{$class} ) { @@ -227,6 +229,8 @@ $classes{$obj->{class}} ||= {}; my $line = $obj->{file}.' line: '.$obj->{line}; #.' ('.$obj->{package}.' -> '.$obj->{subroutine}.')'; $classes{$obj->{class}}->{$line}++; + use Devel::Cycle; + find_cycle($obj->{object}); } foreach my $class (sort keys(%classes)) { printf STDERR "%s\n", $class;
Download (untitled) / with headers
text/plain 441b
On Fri Dec 02 17:50:01 2011, SPROUT wrote: Show quoted text
> It would be nice if Devel::Leak::Object allowed me to specify a > callback function to be called for > each object. The attached file is the little hack I applied for my > debugging needs. Something > more general would be nice, though. > > (On the other hand, if you could provide Devel::Cycle output as an > option, that would be very > useful.)
It turns out this is a duplicate of 39112.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.