FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-155725: Remove PyGILState_Ensure usage from tracemalloc by kumaraditya303 · Pull Request #156409 · python/cpython · GitHub

/ cpython Public

gh-155725: Remove PyGILState_Ensure usage from tracemalloc - #156409

Open
kumaraditya303 wants to merge 1 commit into
python:mainfrom
kumaraditya303:tracemalloc
Open

gh-155725: Remove PyGILState_Ensure usage from tracemalloc#156409
kumaraditya303 wants to merge 1 commit into
python:mainfrom
kumaraditya303:tracemalloc

Conversation

kumaraditya303 commented Aug 26, 2026
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown
Contributor

tracemalloc no longer acquires the GIL nor creates a temporary thread state when tracing memory allocations. A thread with no attached thread state now records the trace with the <unknown> traceback instead of attaching a thread state to capture the Python traceback. C level threads now don't create a thread state unnecessarily just to record a allocation, instead it uses <unknown> traceback if there is no existing active thread state.

tracemalloc no longer acquires the GIL nor creates a temporary thread
state when tracing memory allocations. A thread with no attached thread
state now records the trace with the "<unknown>" traceback instead of
attaching a thread state to capture the Python traceback. Threads
without a thread state used to pay for a GIL acquisition plus a full
thread state creation and destruction on every traced raw allocation,
only to record an empty traceback anyway.

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #34238669 | 📁 Comparing 69d37ec against main (7f0ccd6)

  🔍 Preview build  

2 files changed
± c-api/memory.html
± whatsnew/changelog.html

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant


Back | FazBrowse Home | New Git URL