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 — Temporarily immortalize objects that use deferred reference counting · Issue #117783 · python/cpython

Temporarily immortalize objects that use deferred reference counting #117783

New issue
Copy link
New issue
Copy link
Closed
Closed
Temporarily immortalize objects that use deferred reference counting#117783
Copy link
Labels
topic-free-threadingtype-featureA feature request or enhancementA feature request or enhancement

Description

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

Feature or enhancement

Work is ongoing to implement deferred reference counting in the free-threaded build. The goal is to avoid many of the scaling bottlenecks caused by reference count contention. However, the work is complex and may not be finished in time for the 3.13 beta release and feature freeze.

In the meantime, we should temporarily immortalize objects that would use deferred reference counting in order to avoid bottlenecks that would inhibit scaling.

This has some real downsides: objects that are immortalized are never collected so an application that repeatedly creates many of these objects will leak memory. I think the trade-off is still worth it: if we can't scale multithreaded programs, then the free-threaded build is not particularly useful.

Once we implement deferred reference counting, we will get rid of this.

What types of objects use deferred reference counting?

  • Top-level functions
  • Descriptors
  • Modules and their dictionaries
  • Heap types
  • Code objects

Refleak buildbots

We want the free-threading refleak buildbots to continue to work and catch leaks. In order to do that, we'll want to:

  1. Only do the deferred -> immortal conversion when the first non-main thread is started
  2. Disable the conversion at runtime in the refleak tests via an internal API

Linked PRs

  • gh-117783: Immortalize objects that use deferred reference counting #118112
Reacted by Brett Simmers

Activity

  1. colesbury
    added
    type-featureA feature request or enhancementA feature request or enhancement
    topic-free-threading
    on Apr 11, 2024
  2. colesbury
    added 4 commits that reference this issue on Apr 12, 2024

    Merge branch 'pythongh-117783-immortalize' into nogil-integration

    0351844

    pythongh-117783: Immortalize objects that use deferred reference coun…

    9ff8d52

    pythongh-117783: Immortalize objects that use deferred reference coun…

    30a4133

    Merge branch 'pythongh-117783-immortalize' into nogil-integration

    539595a
  3. colesbury
    added a commit that references this issue on Apr 29, 2024

    gh-117783: Immortalize objects that use deferred reference counting (#…

    7ccacb2
  4. colesbury commented on May 7, 2024

    @colesbury
    colesbury
    on May 7, 2024
    ContributorAuthor
    More actions

    This is implemented now

  5. colesbury
    closed this as completedon May 7, 2024
  6. colesbury
    added 4 commits that reference this issue on Jun 1, 2024

    pythongh-117657: Fix race involving immortalizing objects

    45afd9d

    gh-117657: Fix race involving immortalizing objects (#119927)

    47fb432

    pythongh-117657: Fix race involving immortalizing objects (python#119927

    f4e012c

    [3.13] gh-117657: Fix race involving immortalizing objects (GH-119927) (

    ae70531
  7. mliezun
    added a commit that references this issue on Jun 3, 2024

    pythongh-117657: Fix race involving immortalizing objects (python#119927

    cb8a398
  8. barneygale
    added a commit that references this issue on Jun 5, 2024

    pythongh-117657: Fix race involving immortalizing objects (python#119927

    cc875fa
  9. estyxx
    added a commit that references this issue on Jul 17, 2024

    pythongh-117657: Fix race involving immortalizing objects (python#119927

    470988f
  10. terryjreedy commented on Sep 19, 2024

    @terryjreedy
    terryjreedy
    on Sep 19, 2024
    Member
    More actions

    Immortalization has been removed in 3.14 #124239 (comment)

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

    topic-free-threadingtype-featureA feature request or enhancementA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402520 — 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.