[Python-Dev] Py_CLEAR to avoid crashes
"Martin v. Löwis"
martin at v.loewis.de
Sun Feb 17 21:29:24 CET 2008
More information about the Python-Dev mailing list
Sun Feb 17 21:29:24 CET 2008
- Previous message: [Python-Dev] Py_CLEAR to avoid crashes
- Next message: [Python-Dev] Py_CLEAR to avoid crashes
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Jeffrey Yasskin wrote: > On Feb 16, 2008 3:12 PM, Amaury Forgeot d'Arc <amauryfa at gmail.com> wrote: >> Should we however intensively search and correct all of them? >> Is there a clever way to prevent these problems globally, for example >> by delaying finalizers "just a little"? > > A simple way to do this would be to push objects whose refcounts had > reached 0 onto a list instead of finalizing them immediately, and have > PyEval_EvalFrameEx periodically swap in a new to-delete list and > delete the objects on the old one. -1. This would only soften the problem in a shallow way. It should still be possible to create cases where the final cleanup of the object comes "too early", e.g. when some caller of PyEval_EvalFrameEx still carries a pointer to some object that got deleted, and then still some code can get hold of the then-deleted object. It will just be more difficult to trigger such crashes, depending on the period in which objects are cleaned. The only sane way to never touch deleted objects is to have no references to them on heap anymore, and to not touch stack references after the DECREF. Regards, Martin
- Previous message: [Python-Dev] Py_CLEAR to avoid crashes
- Next message: [Python-Dev] Py_CLEAR to avoid crashes
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list