in reply to Why bother with the mark and sweep garbage collection on non-embedded interpreter shutdown?

At the very least, it's needed in order to call the DESTROY of objects, which may release non-memory resources gracefully (e.g. closing a database connection without forcing the database to timeout) and may take actions (e.g. logging the object's destruction).
  • Comment on Re: Why bother with the mark and sweep garbage collection on non-embedded interpreter shutdown?

Replies are listed 'Best First'.
Re^2: Why bother with the mark and sweep garbage collection on non-embedded interpreter shutdown?
by dynamo (Chaplain) on Jun 15, 2005 at 22:51 UTC
    DESTROY methods are certainly a sufficient reason, at least in cases where they have to be called in a certain order (assuming that the M&S produces a tree of referenced nodes as a side effect, so the roots can be DESTROYed first and pass that along to leaves). If they don't need a certain order, I think just the sweep would do it.

    Any other known rationales I had imagined that the reason we'd have to do the gc at the end _would_ be somehow related to memory resource freeing.

    Anyway, thank you for your answer.