GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Document the new incremental GC · Issue #117759 · python/cpython

Document the new incremental GC #117759

New issue
Copy link
New issue
Copy link
Closed
Closed
Document the new incremental GC#117759
Copy link
Assignees
markshannon
Labels
docsDocumentation in the Doc dirDocumentation in the Doc dir

Description

@markshannon
markshannon
opened on Apr 11, 2024
Issue body actions

Documentation

  • Expand the "what's new" section a bit.
  • Update Doc/library/gc.rst, speciifically how the thresholds work now.
  • Update the dev guide to explain how incremental collection works.

Linked PRs

  • GH-117759: Document incremental GC #123266
  • [3.13] GH-117759: Document incremental GC (GH-123266) #123395
  • GH-117759: Update GC docs for incremental collection #126695

Activity

  1. markshannon
    added
    docsDocumentation in the Doc dirDocumentation in the Doc dir
    on Apr 11, 2024
  2. markshannon
    self-assigned this
    on Apr 11, 2024
  3. markshannon
    added a commit that references this issue on Aug 27, 2024

    GH-117759: Document incremental GC (GH-123266)

    f49a916
  4. miss-islington
    added a commit that references this issue on Aug 27, 2024

    pythonGH-117759: Document incremental GC (pythonGH-123266)

    9cfed51
  5. pablogsal commented on Aug 27, 2024

    @pablogsal
    pablogsal
    on Aug 27, 2024
    Member
    More actions

    Please, also modify https://github.com/python/devguide/blob/main/internals/garbage-collector.rst to keep it in sync with the current implementation

  6. markshannon commented on Aug 27, 2024

    @markshannon
    markshannon
    on Aug 27, 2024
    MemberAuthor
    More actions

    python/devguide#1379

    Reacted by Pablo Galindo Salgado and Savannah Ostrowski
  7. pablogsal commented on Aug 27, 2024

    @pablogsal
    pablogsal
    on Aug 27, 2024
    Member
    More actions

    Thanks 🙏

  8. Yhg1s
    added a commit that references this issue on Sep 2, 2024

    [3.13] GH-117759: Document incremental GC (GH-123266) (#123395)

    aca6511
  9. mr-bronson commented on Sep 4, 2024

    @mr-bronson
    mr-bronson
    on Sep 4, 2024
    More actions

    For the reader, it is confusing that in 3.13 Generation 1 is removed, but also *threshold2* is ignored. One would expect threshold1 to be what is ignored if it is generation 1 that is removed. Previously, the role of threshold2 was never documented anyway. But threshold1 was documented, and it related to generation 1, not generation 2.

    Also, the document indicates no change to the values returned by get_threshold(), which leaves one wondering about whether the threshold for generation 2 is reflected in the third value (as previously) or whether the second value now holds the threshold for generation 2. Without checking, I have no idea.

    (To me it would have made sense to simply change the signatures and return values of all functions that assumed there were three generations, and then document the changes as simply only having two generations now, rather than saying one is removed. If you're already introducing breaking changes in the way something works, then why leave the cruft of extra ignored parameters and undefined or blank return values? But if the goal is some misguided idea of compatibility (even though they fundamentally are not compatible) such that For compatibility, gc.get_objects() pretends there is a generation 1, then the same should apply to the values returned by get_threshold() and accepted by set_threshold(), in which case threshold1 rather than threshold2 should be ignored.)

    Also, the document speaks in three places of the collection frequency. Can someone propose a better, less confusing wording? Frequency is count divided by time. But the so-called "frequency" of collection has nothing to do with time. If these are, as the function and argument names indicate, thresholds in a cycle, then it seems like it should talk about "collection cycle parameters" or something like that rather than frequency. Similarly, time words like "slower" are used when it's not about time:

    The larger threshold1 is, the slower objects in the old generation
    are collected.

    So it's also confusing when the document equates the thresholds with "frequency" when they are inverse to "frequency":

    Set the garbage collection thresholds (the collection frequency).

    Related to this issue is #122862. It points out that the running calculation of the number of allocations minus the number of deallocations since the last collection is never allowed to go below 0, so the current description is inaccurate. The same problem exists in devguide/internals/garbage-collector.rst

    Also, it is noted that Setting *threshold0* to zero disables collection. However, this is confusing because this is a totally different kind of disablement than spoken of elsewhere in the document. In other words, gc.isenabled() will still return True, and gc.enable() does not actually enable collection when threshold0 is zero. Using a different word like "inhibit" or "prevent" rather than "disable" might help to avoid confusion. And if negative values achieve the same thing as zero (don't know, just guessing), then it should be stated as "less than one".

    (Actually, the better option would be for set_threshold to implement proper bounds checking in the first place, so setting less than one would result in an exception. Then you don't have to document stupid edge cases or distinguish between different kinds of disablement. Currently, you can set thresholds as low as -0x80000000, yet both this and the devguide say the threshold is inverse to the "frequency", but that's not true for more than half the possible values the function accepts.)

  10. Yhg1s
    added a commit that references this issue on Sep 29, 2024

    Revert "[3.13] pythonGH-117759: Document incremental GC (pythonGH-123266

    95fe67e
  11. markshannon
    added a commit that references this issue on Nov 14, 2024

    GH-117759: Update GC docs for incremental collection (GH-126695)

    3966d8d
  12. picnixz
    added a commit that references this issue on Dec 8, 2024

    pythonGH-117759: Update GC docs for incremental collection (pythonGH-…

    23e1c3d
  13. markshannon
    closed this as completedon Jan 8, 2025
  14. ebonnal
    added a commit that references this issue on Jan 12, 2025

    pythonGH-117759: Update GC docs for incremental collection (pythonGH-…

    80535aa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @markshannon
    markshannon

Labels

docsDocumentation in the Doc dirDocumentation in the Doc dir

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.