Skip to content

Add a way to trace PyRefTracer_DESTROY events in tracemalloc #130695

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
tom-pytel opened this issue Feb 28, 2025 · 0 comments
Closed

Add a way to trace PyRefTracer_DESTROY events in tracemalloc #130695

tom-pytel opened this issue Feb 28, 2025 · 0 comments
Labels
extension-modules C modules in the Modules dir interpreter-core (Objects, Python, Grammar, and Parser dirs) type-feature A feature request or enhancement

Comments

@tom-pytel
Copy link
Contributor

tom-pytel commented Feb 28, 2025

Feature or enhancement

Proposal:

This suggestion arose from there not currently being a way in python to test for PyRefTracer_DESTROY events (that I could find), specifically from there not being a way to add a regression test for: #130382

Add some simple code to tracemalloc to count PyRefTracer_CREATE and PyRefTracer_DESTROY events.

tracemalloc.start()
tracemalloc.clear_traces()

i = []
del i

refs = tracemalloc.get_traced_refs()

print(refs)  # will print (1, 1)

tracemalloc.stop()

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Linked PRs

@tom-pytel tom-pytel added the type-feature A feature request or enhancement label Feb 28, 2025
tom-pytel added a commit to tom-pytel/cpython that referenced this issue Feb 28, 2025
@picnixz picnixz added interpreter-core (Objects, Python, Grammar, and Parser dirs) extension-modules C modules in the Modules dir labels Feb 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
extension-modules C modules in the Modules dir interpreter-core (Objects, Python, Grammar, and Parser dirs) type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants