Skip to content

new_threadstate() leaks the reserved QSBR slot on failure paths #155363

Description

@nascheme

Bug report

Bug description:

In the free-threaded build, new_threadstate() reserves a QSBR thread-state slot and a TLBC index before it can fail for other reasons, but the failure paths only free the _PyThreadStateImpl.

Found while reviewing GH-148953. I think explaining the monotonic memory growth in the corresponding issue is unlikely, since this leak only happens in the failure case. Still good to fix though.

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions