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 — Execute the garbage collector only on the eval breaker · Issue #97922 · python/cpython

Execute the garbage collector only on the eval breaker #97922

New issue
Copy link
New issue
Copy link
Closed
Closed
Execute the garbage collector only on the eval breaker#97922
Copy link

Description

@pablogsal
pablogsal
opened on Oct 5, 2022
Issue body actions

Currently, the GC can be executed on every object allocation. This has been historically the source of many problems because it can trigger a GC run in points where the VM is in an inconsistent state. This includes critical points of the eval loop but also during complex object creation since the GC can run while creating sub-elements of the final result meanwhile the object is not fully initialized.

To improve the situation, we can schedule a GC run on object allocation but the GC will only run then on the eval breaker in a similar fashion we currently use to run signal handlers, do GIL switch and run pending callbacks.

Activity

  1. pablogsal commented on Oct 5, 2022

    @pablogsal
    pablogsal
    on Oct 5, 2022
    MemberAuthor
    More actions

    One small consideration:

    We can opportunistically check if the GC is scheduled to run and run it if we have a request in PyErr_CheckSignals. This can benefit native code that needs to call PyErr_CheckSignals if is going to run for some time without executing Python code to ensure signals are handled. Checking for the GC here allows long-running native code to clean cycles created using the C-API even if it doesn't run the evaluation loop

  2. pablogsal
    added a commit that references this issue on Oct 8, 2022

    gh-97922: Run the GC only on eval breaker (#97920)

    83eb827
  3. pablogsal
    closed this as completedon Oct 8, 2022
  4. carljm
    added 2 commits that reference this issue on Oct 8, 2022

    Merge branch 'main' into typewatch

    d67d6fd

    Merge branch 'main' into urllibnonet

    132c32e
  5. mpage
    added a commit that references this issue on Oct 11, 2022

    pythongh-97922: Run the GC only on eval breaker (python#97920)

    65d36ba
  6. vstinner
    added 3 commits that reference this issue on Aug 22, 2023

    pythongh-108297: Update test_crashers

    e4dced8

    pythongh-108297: Update test_crashers

    00b9633

    pythongh-108297: Update test_crashers

    895f2fa
  7. nsrip-dd
    added 2 commits that reference this issue on Apr 2, 2025

    refactor(profiling): add memalloc race regression test

    1a2035f

    refactor(profiling): add memalloc race regression test (#13026)

    9bed3a9
  8. chojomok
    added a commit that references this issue on Apr 7, 2025

    refactor(profiling): add memalloc race regression test (#13026)

    60d60a2
  9. taegyunkim
    added a commit that references this issue on Feb 6, 2026

    fix(profiling): enable GC guard for Python 3.12+ to prevent reentranc…

    67fafb6
  10. anblanco
    added 3 commits that reference this issue on Apr 4, 2026

    [SPARK-53759][PYTHON] Fix missing flush in simple-worker path

    85fa97f

    SPARK-53759 reproducer: root cause analysis and verified fix

    988991b

    SPARK-53759 reproducer: root cause analysis and verified fix

    c9b560e
  11. dongjoon-hyun
    added 3 commits that reference this issue on Apr 8, 2026

    [SPARK-53759][PYTHON][4.1] Fix missing flush in simple-worker path

    a3b502e

    [SPARK-53759][PYTHON][4.0] Fix missing close in simple-worker path

    26a73d3

    [SPARK-53759][PYTHON][3.5] Fix missing close in simple-worker path

    8b8e00b
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

    No labels
    No labels

    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.