Message374424
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. |
|
Date |
User |
Action |
Args |
2020-07-27 20:58:43 | tim.peters | set | recipients:
+ tim.peters, ian_osh |
2020-07-27 20:58:43 | tim.peters | set | messageid: <1595883523.16.0.191706729253.issue41389@roundup.psfhosted.org> |
2020-07-27 20:58:43 | tim.peters | link | issue41389 messages |
2020-07-27 20:58:42 | tim.peters | create | |
|