[issue41455] Python Devguide differs from python docs
New submission from Yaroslac <flower.moor@gmail.com>: As I can see here https://github.com/python/devguide/blob/master/garbage_collector.rst#collect...
the GC only triggers a full collection of the oldest generation if the ratio long_lived_pending / long_lived_total is above a given value (hardwired to 25%)
But in the python docs here https://docs.python.org/3.10/library/gc.html#gc.set_threshold
When the number of allocations minus the number of deallocations exceeds threshold0, collection starts. Initially only generation 0 is examined. If generation 0 has been examined more than threshold1 times since generation 1 has been examined, then generation 1 is examined as well. Similarly, threshold2 controls the number of collections of generation 1 before collecting generation 2.
So, which one is correct? ---------- assignee: docs@python components: Documentation messages: 374665 nosy: Yaroslav, docs@python priority: normal severity: normal status: open title: Python Devguide differs from python docs type: resource usage versions: Python 3.10, Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue41455> _______________________________________
Yaroslav <flower.moor@gmail.com> added the comment: As I can see here https://github.com/python/devguide/blob/master/garbage_collector.rst#collect...
the GC only triggers a full collection of the oldest generation if the ratio long_lived_pending / long_lived_total is above a given value (hardwired to 25%)
But in the python docs here https://docs.python.org/3.10/library/gc.html#gc.set_threshold
When the number of allocations minus the number of deallocations exceeds threshold0, collection starts. Initially only generation 0 is examined. If generation 0 has been examined more than threshold1 times since generation 1 has been examined, then generation 1 is examined as well. Similarly, threshold2 controls the number of collections of generation 1 before collecting generation 2.
As I can see here: https://github.com/python/cpython/blob/master/Modules/gcmodule.c#L1456 the first one is correct. We should probably fix python docs accordingly. ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue41455> _______________________________________
Change by Roundup Robot <devnull@psf.upfronthosting.co.za>: ---------- keywords: +patch nosy: +python-dev nosy_count: 2.0 -> 3.0 pull_requests: +20846 stage: -> patch review pull_request: https://github.com/python/cpython/pull/21703 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue41455> _______________________________________
Yaroslav <flower.moor@gmail.com> added the comment: Here's opened PR. https://github.com/python/cpython/pull/21703 ---------- nosy: -python-dev _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue41455> _______________________________________
Change by Terry J. Reedy <tjreedy@udel.edu>: ---------- versions: -Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue41455> _______________________________________
Change by Terry J. Reedy <tjreedy@udel.edu>: ---------- nosy: +pablogsal, pitrou _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue41455> _______________________________________
Pablo Galindo Salgado <pablogsal@gmail.com> added the comment: New changeset 82ca8fada15b121866530f2cdac1b7055be4a244 by Yaroslav Pankovych in branch 'master': bpo-41455: Provide a link to how the third generation is collected in the GC docs (GH-21703) https://github.com/python/cpython/commit/82ca8fada15b121866530f2cdac1b7055be... ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue41455> _______________________________________
Change by miss-islington <mariatta.wijaya+miss-islington@gmail.com>: ---------- nosy: +miss-islington nosy_count: 4.0 -> 5.0 pull_requests: +20928 pull_request: https://github.com/python/cpython/pull/21786 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue41455> _______________________________________
Change by miss-islington <mariatta.wijaya+miss-islington@gmail.com>: ---------- pull_requests: +20929 pull_request: https://github.com/python/cpython/pull/21787 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue41455> _______________________________________
Change by miss-islington <mariatta.wijaya+miss-islington@gmail.com>: ---------- pull_requests: +20930 pull_request: https://github.com/python/cpython/pull/21788 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue41455> _______________________________________
Change by Pablo Galindo Salgado <pablogsal@gmail.com>: ---------- resolution: -> fixed stage: patch review -> resolved status: open -> closed _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue41455> _______________________________________
miss-islington <mariatta.wijaya+miss-islington@gmail.com> added the comment: New changeset 103ce3debf07a48e79319acd0890be0c53e64fff by Miss Islington (bot) in branch '3.9': bpo-41455: Provide a link to how the third generation is collected in the GC docs (GH-21703) https://github.com/python/cpython/commit/103ce3debf07a48e79319acd0890be0c53e... ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue41455> _______________________________________
miss-islington <mariatta.wijaya+miss-islington@gmail.com> added the comment: New changeset 105cfb5b182da63e8481fcb009e92546d240c6b5 by Miss Islington (bot) in branch '3.8': bpo-41455: Provide a link to how the third generation is collected in the GC docs (GH-21703) https://github.com/python/cpython/commit/105cfb5b182da63e8481fcb009e92546d24... ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue41455> _______________________________________
Ned Deily <nad@python.org> added the comment: New changeset f3b6f3cd9ac6931ae346cf298fae7b691d5656bb by Miss Islington (bot) in branch '3.7': bpo-41455: Provide a link to how the third generation is collected in the GC docs (GH-21703) (GH-21788) https://github.com/python/cpython/commit/f3b6f3cd9ac6931ae346cf298fae7b691d5... ---------- nosy: +ned.deily _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue41455> _______________________________________
participants (7)
-
miss-islington
-
Ned Deily
-
Pablo Galindo Salgado
-
Roundup Robot
-
Terry J. Reedy
-
Yaroslac
-
Yaroslav