Message110973
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. |
|
Date |
User |
Action |
Args |
2010-07-20 21:03:47 | kristjan.jonsson | set | recipients:
+ kristjan.jonsson, tim.peters, loewis, rhettinger, amaury.forgeotdarc, pitrou, stutzbach |
2010-07-20 21:03:46 | kristjan.jonsson | set | messageid: <1279659826.87.0.0279199412004.issue9141@psf.upfronthosting.co.za> |
2010-07-20 21:03:44 | kristjan.jonsson | link | issue9141 messages |
2010-07-20 21:03:43 | kristjan.jonsson | create | |
|