develooper Front page | perl.perl5.porters | Postings from March 2017

Re: [perl #32714] Objects destroyed in the wrong order during globaldestruction

Thread Previous | Thread Next
Dave Mitchell
March 14, 2017 08:45
Re: [perl #32714] Objects destroyed in the wrong order during globaldestruction
Message ID:
On Mon, Mar 13, 2017 at 08:52:09AM -0700, Nick Wellnhofer via RT wrote:
> On Mon, 13 Mar 2017 02:31:15 -0700, davem wrote:
> > But has just been pointed out, freeing package vars before calling
> > destructors breaks everything.
> I realize that this problem is harder than I initially thought. But I
> think it could be solved by deferring freeing of package vars during
> global destruction. So if a refcount drops to zero, DESTROY is invoked,
> the object is not freed, but refcounts of other objects that are
> referred to are decreased. In other words, you simulate freeing an
> object just for refcount side effects. Then, in a second pass, DESTROY
> is invoked on objects that still have a refcount (because of circular
> references or refcount leaks).

Can you provide a short, self-contained perl program which demonstrates
the bug, and which would be fixed by why you propose above; just so that 
we can be sure we're all discussing the same issue.

In economics, the exam questions are the same every year.
They just change the answers.

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About