Skip Menu |
 

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

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

People
Owner: Nobody in particular
Requestors: asjo [...] koldfront.dk
Cc:
AdminCc:

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



Subject: DESTROY not always called
Download (untitled) / with headers
text/plain 2.3k
I am not sure this is a bug, but it seems to me like DESTROY isn't always called the same number of times when Devel::Leak::Object (GLOBAL_bless) is activated compared to when it isn't. I'm not sure that it ought to, but I think so? I have created a little test-program (attached) that shows this. When I run it, I get this output when D:L:O is commented out: car Car=HASH(0x6ecdd0) * DESTROY Car=HASH(0x6ecdd0) producer Producer=HASH(0x6ecdd0) car Car=HASH(0x6ece20) * DESTROY Car=HASH(0x6ece20) * DESTROY Producer=HASH(0x6ecdd0) car Car=HASH(0x6ece30) * DESTROY Car=HASH(0x6ece30) which makes sense to me, I create a car and it is DESTROYed as it goes out of scope, then a producer and a car, also DESTROYed, and finally another car; DESTROYed. If I comment in Devel::Leak::Object qw{ GLOBAL_bless }, I get this output: Devel::Leak::Object version: 0.92 car Car=HASH(0x736610) * DESTROY Car=HASH(0x736610) producer Producer=HASH(0x736610) car Car=HASH(0x7461c0) * DESTROY Producer=HASH(0x736610) car Car=HASH(0x746140) Tracked objects by class: Now, after I have created a producer, no cars are DESTROYed anymore! I think it has to do with how Devel::Leak::Object::DESTROY_NEXT is populated and interpreted, because if I add a warn line like this: --- Object.pm.orig 2008-10-08 11:36:59.000000000 +0200 +++ Object.pm 2008-10-08 16:35:14.000000000 +0200 @@ -119,6 +119,7 @@ } my \$super = \$Devel::Leak::Object::DESTROY_NEXT{\$original}->{'$class'}; unless ( defined \$super ) { + warn "Failed to find super-method for class \$class in package $class"; die "Failed to find super-method for class \$class in package $class"; } if ( \$super ) { I get this output: Devel::Leak::Object version: 0.92 car Car=HASH(0x736590) * DESTROY Car=HASH(0x736590) producer Producer=HASH(0x736590) car Car=HASH(0x745980) Failed to find super-method for class Car in package Producer at (eval 5) line 46. * DESTROY Producer=HASH(0x736590) car Car=HASH(0x745900) Failed to find super-method for class Car in package Producer at (eval 5) line 46. Tracked objects by class: I haven't really understood how the DESTROY_NEXT structure is supposed to work, so I may very well be mistaken. If this is a bug, I will be happy to rework my program into the tests (I must admit I haven't looked at them yet.) Best regards, (an(other)) Adam
Subject: test_leak
Download test_leak
application/octet-stream 1k

Message body not shown because it is not plain text.

From: Adam Sjøgren
Download (untitled) / with headers
text/plain 198b
Maybe I should have noted that I came across this in a larger application that uses Log4perl and BioPerl, and from what I gathered there created the small test-example attached. Best regards, Adam.
Subject: Re: [rt.cpan.org #39893] DESTROY not always called
Date: Thu, 9 Oct 2008 03:05:58 +1100
To: bug-Devel-Leak-Object [...] rt.cpan.org
From: "Adam Kennedy" <adamkennedybackup [...] gmail.com>
Thanks for the bug report, that test_leak program should be enough for me to build up a test script if needed. Adam K 2008/10/9 http://asjo.koldfront.dk/ via RT <bug-Devel-Leak-Object@rt.cpan.org>: Show quoted text
> Wed Oct 08 10:44:48 2008: Request 39893 was acted upon. > Transaction: Ticket created by http://asjo.koldfront.dk/ > Queue: Devel-Leak-Object > Subject: DESTROY not always called > Broken in: (no value) > Severity: (no value) > Owner: Nobody > Requestors: asjo@koldfront.dk > Status: new > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=39893 > > > > I am not sure this is a bug, but it seems to me like DESTROY isn't > always called the same number of times when Devel::Leak::Object > (GLOBAL_bless) is activated compared to when it isn't. I'm not sure that > it ought to, but I think so? > > I have created a little test-program (attached) that shows this. When I > run it, I get this output when D:L:O is commented out: > > car Car=HASH(0x6ecdd0) > * DESTROY Car=HASH(0x6ecdd0) > producer Producer=HASH(0x6ecdd0) > car Car=HASH(0x6ece20) > * DESTROY Car=HASH(0x6ece20) > * DESTROY Producer=HASH(0x6ecdd0) > car Car=HASH(0x6ece30) > * DESTROY Car=HASH(0x6ece30) > > which makes sense to me, I create a car and it is DESTROYed as it goes > out of scope, then a producer and a car, also DESTROYed, and finally > another car; DESTROYed. > > If I comment in Devel::Leak::Object qw{ GLOBAL_bless }, I get this output: > > Devel::Leak::Object version: 0.92 > car Car=HASH(0x736610) > * DESTROY Car=HASH(0x736610) > producer Producer=HASH(0x736610) > car Car=HASH(0x7461c0) > * DESTROY Producer=HASH(0x736610) > car Car=HASH(0x746140) > Tracked objects by class: > > Now, after I have created a producer, no cars are DESTROYed anymore! > > I think it has to do with how Devel::Leak::Object::DESTROY_NEXT is > populated and interpreted, because if I add a warn line like this: > > --- Object.pm.orig 2008-10-08 11:36:59.000000000 +0200 > +++ Object.pm 2008-10-08 16:35:14.000000000 +0200 > @@ -119,6 +119,7 @@ > } > my \$super = > \$Devel::Leak::Object::DESTROY_NEXT{\$original}->{'$class'}; > unless ( defined \$super ) { > + warn "Failed to find super-method for class \$class in package > $class"; > die "Failed to find super-method for class \$class in package > $class"; > } > if ( \$super ) { > > I get this output: > > Devel::Leak::Object version: 0.92 > car Car=HASH(0x736590) > * DESTROY Car=HASH(0x736590) > producer Producer=HASH(0x736590) > car Car=HASH(0x745980) > Failed to find super-method for class Car in package Producer at (eval > 5) line 46. > * DESTROY Producer=HASH(0x736590) > car Car=HASH(0x745900) > Failed to find super-method for class Car in package Producer at (eval > 5) line 46. > Tracked objects by class: > > I haven't really understood how the DESTROY_NEXT structure is supposed > to work, so I may very well be mistaken. > > If this is a bug, I will be happy to rework my program into the tests (I > must admit I haven't looked at them yet.) > > Best regards, (an(other)) Adam >


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.