Message110973
| Author |
kristjan.jonsson |
| Recipients |
amaury.forgeotdarc, kristjan.jonsson, loewis, pitrou, rhettinger, stutzbach, tim.peters |
| Date |
2010年07月20日.21:03:43 |
| SpamBayes Score |
0.0026276645 |
| Marked as misclassified |
No |
| Message-id |
<1279659826.87.0.0279199412004.issue9141@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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. |
|