Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork34.2k
GH-144688: Fix refleaks in JIT when optimization fails#145420
Open
markshannon wants to merge 1 commit intopython:mainfrom
Open
GH-144688: Fix refleaks in JIT when optimization fails#145420markshannon wants to merge 1 commit intopython:mainfrom
markshannon wants to merge 1 commit intopython:mainfrom
Conversation
MemberAuthor
markshannon commentedMar 2, 2026
Skipping news as this bug didn't make it into a release |
| // Clear all recorded values | ||
| _PyJitUopBuffer *buffer = &tracer->code_buffer; | ||
| for (_PyUOpInstruction *inst = buffer->start; inst < buffer->next; inst++) { | ||
| if (_PyUop_Flags[inst->opcode] & HAS_RECORDS_VALUE_FLAG) { |
Member
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I think this means you can remove
else if (_PyUop_Flags[opcode] & HAS_RECORDS_VALUE_FLAG) { Py_XDECREF((PyObject *)(uintptr_t)buffer[pc].operand0); buffer[pc].opcode = _NOP; }in optimizer.c to avoid double work?
MemberAuthor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
We don't do double work:https://github.com/python/cpython/pull/145420/changes#diff-de09f74c4306be5ef0284d665091976873569094d645a35b48467ea2a11d67f7R1531 and it is faster to leave the cleanup in the fixup pass as we have to do that pass anyway in the normal, non-error case.
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 freeto join this conversation on GitHub. Already have an account?Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading.Please reload this page.
Make sure that we clear references to recorded objects when cleaning up JIT.