[Python-Dev] Cycle collection enhancement idea (original) (raw)

eyal.lotem+pyutils@gmail.com eyal.lotem at gmail.com
Sun Jun 29 14🔞46 CEST 2008


On Jun 29, 3:04 pm, Antoine Pitrou <solip... at pitrou.net> wrote:

eyal.lotem+pyutils gmail.com <eyal.lotem gmail.com> writes:

> This is exactly what my post tried to address. > I assumed it was clear that module clearing is the wrong solution, and > that it was also clear that due to the cycles I mentioned > (global.class.dict['anymethod'].funcglobals['global'] is > global), all globals that have a del will not be collectible. > Therefore, I proposed a solution to cycles with a del in them. > Only with this solution it is possible to replace module clearing with > normal garbage collection. A more generic solution would be to pass a special flag to the GC when it is called as part of interpreter shutdown. This flag would instruct it to not put aside objects with finalizers, but first call all their del methods and then collect them all at once regardless of whether they are part of a cycle or not.

That would be no worse than what happens now - but its still not perfect (del ordering issues). Also, you would need to temporarily revive the cycles as mentioned above (to avoid accessibility of partially destructed objects).


Python-Dev mailing list Python-... at python.orghttp://mail.python.org/mailman/listinfo/python-dev Unsubscribe:http://mail.python.org/mailman/options/python-dev/python-dev2-garchiv...



More information about the Python-Dev mailing list