develooper Front page | perl.perl5.porters | Postings from August 2013

Reliable global destruction?

Thread Next
Leon Timmermans
August 18, 2013 17:44
Reliable global destruction?
Message ID:
Currently, global destruction is a (mostly) two phase: objects and
then non-objects. In the first phase, objects are destroyed in random
order, so any destructor had to take this into account. In many cases,
that means that the destructor skips itself when global destruction is
going on because it can't know if any object it depends on is still
alive, this is rather unfortunate for a variety of reasons. But what
if we did support reliable global destruction?

How? By first doing a topological sort[1] of the object graph, and
then destroying them root-up. There are some caveats there: it doesn't
handle hard loops and fieldhashes are a bit tricky too (though I think
that's fixable). And then there are objects created during global

Still, I'm fairly certain the situation can be made a lot more sane
than it currently is. I'm just not sure what the runtime cost of this
would be. I can only imagine it being more than a mark-and-sweep
garbage collection cycle, but then again it's only done once.



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