Skip to content
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

gh-58956: Fix a frame refleak in bdb #128190

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

gaogaotiantian
Copy link
Member

@gaogaotiantian gaogaotiantian commented Dec 23, 2024

We added self.enterframe in bdb.Bdb, but that will leak the frame reference of the enterframe until the next time the debugger is triggered. As the frame is a linked list, one leaked frame will also leak many others. We should fix this.

This is not a bug fix per se, but this blocks #125549, which is a backport for a bug fix. So we should backport this to 3.12 and 3.13, then merge the bug fix in #125549 to avoid leaking frames.

@@ -404,6 +404,7 @@ def set_trace(self, frame=None):
frame.f_trace_lines = True
frame = frame.f_back
self.set_stepinstr()
self.enterframe = None
Copy link
Member

@iritkatriel iritkatriel Dec 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be in a finally block?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants