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.

classification
Title: Full gc collection blocked from collecting after some amount of objects in oldest gen
Type: behavior Stage: resolved
Components: Extension Modules Versions: Python 3.10
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: al3x3i.k, iritkatriel, pablogsal, pitrou
Priority: normal Keywords:

Created on 2022-03-03 14:48 by al3x3i.k, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (3)
msg414444 - (view) Author: Alexei Komarov (al3x3i.k) Date: 2022-03-03 14:48
Hi!

Maybe it is just my misunderstanding of the mechanism, so please excuse me if it is so. Looking at the GC module code, I think that once there are X objects in the oldest gen, a full collection blocked due to the condition https://github.com/python/cpython/blob/3.10/Modules/gcmodule.c#L1465-L1467 being always True.

So, if youngest gen is collected each 700 objects, the middle gen will have maximum 7000 objects. Full collection will be triggered each ~70K objects. X/4 = 70000 ===> X=280000. If oldest gen has >280K objects in it, the condition for full collection (long_lived_pending < gcstate->long_lived_total / 4) is always true since to my understanding, long_lived_pending is 70K at most, and got zeroed each full collection (https://github.com/python/cpython/blob/3.10/Modules/gcmodule.c#L1253).
msg414641 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2022-03-07 07:54
See if you can write a script that makes this happen.
msg414644 - (view) Author: Alexei Komarov (al3x3i.k) Date: 2022-03-07 09:02
Oh, I see it now. I've been missing the fact that long_lived_pending is accumulated each 1st gen collection until full collection.

Thanks!
History
Date User Action Args
2022-04-11 14:59:56adminsetgithub: 91068
2022-03-07 09:02:31al3x3i.ksetstatus: open -> closed

messages: + msg414644
stage: resolved
2022-03-07 07:54:07iritkatrielsetnosy: + iritkatriel
messages: + msg414641
2022-03-07 07:42:39al3x3i.ksetnosy: + pitrou, pablogsal
2022-03-03 14:48:34al3x3i.kcreate