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

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

Scott E Lee
October 29, 2001 06:20
[ID 20011029.061] bug in perl's object destructor logic
Message ID:
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: attached file: myconfig.txt)
Scott E. Lee
(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 Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About