develooper Front page | perl.perl5.porters | Postings from October 2001

[ID 20011029.061] bug in perl's object destructor logic

From:
Scott E Lee
Date:
October 29, 2001 06:20
Subject:
[ID 20011029.061] bug in perl's object destructor logic
Message ID:
OFFDF1080C.FB762150-ON85256AF4.004DE042@raleigh.ibm.com
I found a bug in perl's object destructor logic.  The enclosed
program shows that the DESTROY subroutines are called in the wrong
order.  It should be A, B, C, D then E.  If you remove the "$obj;"
line (line 7) the problem goes away.

The problem exists in both 5.005_03 and v5.6.1 on Linux.

My guess is that referring directly to the variable in a subroutine
(as opposed to passing it as a parameter) somehow causes it to not
be garbage collected when it goes out of scope at the end of the
program.  This leaves the object and the ones it contains to be
garbage collected in some pseudo random order as the interpreter
shuts down.
(See attached file: bug.pl)(See attached file: myconfig.txt)
--
Scott E. Lee
scottele@us.ibm.com
(919)254-7995  T/L 8-444-7995
IBM  Storage Systems Group
Storage Networking Division
  "It's hard to tie your shoes when a cat is watching!"  -- Me


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About