in reply to Re: Object Destructors and Signals
in thread Object Destructors and Signals

Your object is a global variable or it is referenced by one. It is surviving past the end of all lexical scopes, forcing Perl to guess how to destroying what's left in memory. During global destruction, Objects can be destroyed in any order.

I'd agree with all of that except for "forcing Perl to guess how to destroying what's left in memory". There is no "forcing" involved. It is more accurate to say "getting to the point where perl no longer cares in which order it destroys things".

Global destruction is not done in an orderly fashion simply for the sake of expediency (with a name like "global destruction", what did you expect? ;). The lack of ordering is simply an optimization.

- tye        

  • Comment on Re^2: Object Destructors and Signals (optimization)

Replies are listed 'Best First'.
Re^3: Object Destructors and Signals (optimization)
by ikegami (Patriarch) on Nov 05, 2010 at 16:22 UTC
    oh but it does care. There's a number of factors it considers to determine the order in which things are freed. In fact, improvements were made there for 5.14. Maybe it just doesn't care enough.