This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author tim.peters
Recipients ian_osh, tim.peters
Date 2020-07-27.20:58:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1595883523.16.0.191706729253.issue41389@roundup.psfhosted.org>
In-reply-to
Content
It's impossible for any implementation to know that cyclic trash _is_ trash without, in some way, traversing the object graph. This is expensive, so CPython (or any other language) does not incur that expense after every single decref that leaves a non-zero refcount (the one and only cheap clue that cyclic trash _may_ have just been created).

If you want/need synchronous behavior, avoid cycles. CPython's refcounting does dispose of trash the instant an object (not involved in a cycle) becomes trash. That behavior cannot be extended to cyclic trash short of (as above) running a cyclic gc pass extremely frequently.

I don't know of any language that guarantees all garbage will be collected "right away". Do you?  CPython does much more in that respect (due to primarily relying on refcounting) than most.
History
Date User Action Args
2020-07-27 20:58:43tim.peterssetrecipients: + tim.peters, ian_osh
2020-07-27 20:58:43tim.peterssetmessageid: <1595883523.16.0.191706729253.issue41389@roundup.psfhosted.org>
2020-07-27 20:58:43tim.peterslinkissue41389 messages
2020-07-27 20:58:42tim.peterscreate