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 — Add an "assert mode" to `-X showrefcount` that fails when references leak · Issue #94755 · python/cpython

Add an "assert mode" to -X showrefcount that fails when references leak #94755

New issue
Copy link
New issue
Copy link
Open
Open
Add an "assert mode" to -X showrefcount that fails when references leak#94755
Copy link
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancementA feature request or enhancement

Description

@encukou
encukou
opened on Jul 11, 2022
Issue body actions

The -X showrefcount option currently prints the number of references at exit.
Once we get the number to 0, we should test that it stays that way. It would be nice to add a mode, say -X showrefcount=assert0 or -X checkrefcount, that exits with nonzero if refs/blocks remain. Then it can be used in subprocess tests.

cc @vstinner

Activity

  1. encukou
    added
    type-featureA feature request or enhancementA feature request or enhancement
    on Jul 11, 2022
  2. jkloth commented on Jul 11, 2022

    @jkloth
    jkloth
    on Jul 11, 2022
    Contributor
    More actions

    There is an existing test for 0 leaked refcounts: test_embed.test_no_memleak.

    It currently only ensures that leaks do not occur within just an init/fini cycle.

  3. vstinner commented on Aug 3, 2022

    @vstinner
    vstinner
    on Aug 3, 2022
    Member
    More actions

    I'm not sure if such feature would be useful today, since there are still many Python stdlib extensions which leak memory at exit :-(

    • Convert static types to heap types: use PyType_FromSpec() #84258
    • Clear static types in Py_Finalize() for embedded Python #90575 (comment)

    Well, at least last time I checked. Maybe things went better since I checked.

  4. encukou commented on Aug 4, 2022

    @encukou
    encukou
    on Aug 4, 2022
    MemberAuthor
    More actions

    Well, there are some extensions/tests that don't leak memory, and the option could be used to ensure those don't start leaking.

  5. iritkatriel
    added
    interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)
    on Nov 27, 2023
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

    interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-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.