Kristján Valur Jónsson <krist...@ccpgames.com> added the comment: I agree that this is not the _optimal_ solution, and that when you are collecting stuff, say a list of many items, it will cause X indirect calls to all of the things in the list.
My counterargument is, however, that all those items will, if collected, be handed off to the final Py_DECREF with all the baggage that that entails, ultimately resulting in PyObject_Free or PyMem_Free. An extra indirect call, (only for unreachable objects, btw, which is only a small objects of all objects visited during a GC pass) should not play a significatn part in the process. An alternative to this extra tp_traverse() pass, would be to flag objects that report that they are or are not collectable, with a special value in gc_refs, probably a bitmask. But this would be a much more intrusive change in an algorithm that is far from simple, and so need very rigorous review and testing. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue9141> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com