Sitelet https://github.com/python/cpython/issues/140301
Skip to content

Memory leak in test_capi with subinterpreter creation #140301

Description

@ashm-dev

Bug report

Bug description:

LeakSanitizer detects memory leaks when running test_capi with refleak detection. The leaks occur during subinterpreter creation via Py_NewInterpreterFromConfig().

Affected Versions

  • Python 3.12
  • Python 3.13
  • Python 3.14
  • CPython main branch

Steps to Reproduce

  1. Build CPython with AddressSanitizer and debug mode:
CC=clang CXX=clang++ ./configure --with-address-sanitizer --with-pydebug --with-undefined-behavior-sanitizer --disable-optimizations && make -j$(nproc)
  1. Run test_capi with refleak detection:
./python -X dev -X showrefcount -m test -R 5:5 test_capi -j$(nproc)

Logs

312.log
313.log
314.log
main.log

CPython versions tested on:

3.15, CPython main branch, 3.14, 3.13, 3.12

Operating systems tested on:

Linux

Linked PRs

Activity

  1. ZeroIntensity commented on Oct 18, 2025

    @ZeroIntensity
    Member

    In the future, would you mind including locations (preferably a GitHub source link) in your reports? It's extra work for us when you just drop large log files.

  2. ashm-dev commented on Oct 18, 2025

    @ashm-dev
    ContributorAuthor

    Sure, I'll include GitHub source links in future reports. Thanks for the feedback!

  3. ashm-dev commented on Oct 18, 2025

    @ashm-dev
    ContributorAuthor

    I'll take a shot at fixing this, but no promises :)

  4. added a commit that references this issue on Oct 18, 2025
  5. added a commit that references this issue on Oct 20, 2025
  6. added a commit that references this issue on Oct 20, 2025
  7. added a commit that references this issue on Oct 20, 2025
  8. added 3 commits that reference this issue on Oct 27, 2025
  9. added a commit that references this issue on Oct 27, 2025
  10. added a commit that references this issue on Dec 6, 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

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions