Repository navigation
fix: memory leak in document paste edits - #338233
Dmitriy Vasyura (dmitrivMS) merged 9 commits into
Conversation
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The cache lifecycle fix is narrowly scoped and directly covered by regression tests.
Review effort: Balanced
Findings: None
What changed in this PR
Fixes extension-host paste-edit cache leaks caused by mismatched request and cache IDs.
Changes:
- Releases paste edits using their returned cache ID.
- Avoids caching empty edit results.
- Adds regression coverage for declined and empty requests.
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Dmitriy Vasyura (dmitrivMS)
left a comment
There was a problem hiding this comment.
Please see comments
|
Thanks for the feedback! It may take a bit until I get through all of it. I'm just wondering what do you use to create the ai review comments? Like asking copilot or claude to do a review of pr I'm thinking to integrate some kind of ai review like that for the draft prs I first make in https://github.com/SimonSiefke/vscode/pulls?q=sort%3Aupdated-desc+is%3Apr+state%3Aopen+ before making them "more polished" PRs to VS Code. Thanks again. :) |
|
Here's are standing instructions for an army of Agent Hosts :-) I made some updates since then, but this is essentially it: |
|
Simon Siefke (@SimonSiefke) Thank YOU for all the fixes! |
|
Ah, I also have some review |

Details
Paste edit cleanup uses the data-transfer request ID instead of the returned edit-cache ID. When a provider declines requests, the IDs drift apart and closing the paste editor leaves old edits in the extension-host cache. Empty results are also cached even though they contain no release ID.
Change
Release paste edits using the cache ID returned with the edits, and do not cache empty results.
Before
When pasting into and closing 37 editors, with the provider declining two requests before returning each edit, 37 paste edits remain in the extension-host cache:
After
No more paste-edit cache growth is detected in the same 37-cycle test.
Test Video
paste-test.mp4
AI disclosure: Model: GPT 6 Astra. Worktime: 37 min