Skip to content

Fix obsolete comments in gc.c #137562

Description

@sergey-miryanov

1

gc.c/subtract_refs references an obsolete constant GC_REACHABLE

cpython/Python/gc.c

Lines 572 to 577 in 34d7351

/* Subtract internal references from gc_refs. After this, gc_refs is >= 0
* for all objects in containers, and is GC_REACHABLE for all tracked gc
* objects not in containers. The ones with gc_refs > 0 are directly
* reachable from outside containers, and so can't be collected.
*/
static void

It is obsolete since #7043

2

gc.c/SCAN_RATE_DIVISOR has obsolete comment about calculating incremental threshold based on count of survivors. It is obsolete since #117120

cpython/Python/gc.c

Lines 1345 to 1362 in 34d7351

/* Making progress in the incremental collector
* In order to eventually collect all cycles
* the incremental collector must progress through the old
* space faster than objects are added to the old space.
*
* Each young or incremental collection adds a number of
* objects, S (for survivors) to the old space, and
* incremental collectors scan I objects from the old space.
* I > S must be true. We also want I > S * N to be where
* N > 1. Higher values of N mean that the old space is
* scanned more rapidly.
* The default incremental threshold of 10 translates to
* N == 1.4 (1 + 4/threshold)
*/
/* Divide by 10, so that the default incremental threshold of 10
* scans objects at 1% of the heap size */
#define SCAN_RATE_DIVISOR 10

3

Reference #135552 instead of #91636 when writing about deallocated objects in the type cache.

Linked PRs

Activity

  1. StanFromIreland commented on Aug 8, 2025

    @StanFromIreland
    Member

    Hello, for the future, there is no need to create issues for trivial things that won’t need a blurb and longer discussion.

  2. sergey-miryanov commented on Aug 8, 2025

    @sergey-miryanov
    ContributorAuthor

    @StanFromIreland Thanks! Will keep in mind.

  3. AA-Turner commented on Aug 8, 2025

    @AA-Turner
    Member

    It also doesn't hurt, we have an unlimited supply of issue numbers! In this case it might've made sense to combine the two PRs, though, as both are looking at the same topic (correcting confusing/out-of-date information).

    A

  4. sergey-miryanov commented on Aug 8, 2025

    @sergey-miryanov
    ContributorAuthor

    @AA-Turner When I split them, I thought both changes can be discussed separately. I believe we should apply both changes because they are confusing. However, I think someone may want to keep notes about the survivor count for historical reasons, even though I think it is confusing now anyway.

    But I open to merge them in one PR - just direct me :)

  5. added a commit that references this issue on Aug 9, 2025
  6. added a commit that references this issue on Aug 12, 2025
  7. added 2 commits that reference this issue on Aug 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dirinterpreter-core(Objects, Python, Grammar, and Parser dirs)

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions