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

Fix VT parser memory leak in tracing #8618

Merged
1 commit merged into from
Jan 4, 2021
Merged

Conversation

miniksa
Copy link
Member

@miniksa miniksa commented Dec 19, 2020

Fix memory leak that occurs from not dispatching the end of sequences on all actions (since it is buffering up all characters for trace reasons.) Also don't bother storing if no one is listening.

PR Checklist

  • Fixes leak found while bumbling around.
  • I work here.

Detailed Description of the Pull Request / Additional comments

  • We trace all the things leading up to the Action phase in the VT parser for ETW tracing to make debugging the parser easier, but we made two mistakes.
  • At some point, three of the actions (related to print/execute) weren't dispatching the stored up sequence to tracing and not clearing it. So printing/executing in a giant run over and over caused the vector to bloat and bloat and bloat forever.
  • We're storing things even when no one is listening. That's a waste.

Validation Steps Performed

  • Watched it grow every time I did type big.txt under taskman.exe. Then watched it not do that after.
  • I did technically WPR it to figure out this was the culprit.

… on all actions (since it is buffering up all characters for trace reasons.) Also don't bother storing if no one is listening.
@miniksa miniksa added Product-Conhost For issues in the Console codebase Area-Performance Performance-related issue Product-Conpty For console issues specifically related to conpty Issue-Bug It either shouldn't be doing this or needs an investigation. Product-Terminal The new Windows Terminal. labels Dec 19, 2020
@zadjii-msft zadjii-msft self-assigned this Jan 4, 2021
@zadjii-msft
Copy link
Member

@miniksa you think this might have been #8283?

@zadjii-msft zadjii-msft removed their assignment Jan 4, 2021
@miniksa
Copy link
Member Author

miniksa commented Jan 4, 2021

@miniksa you think this might have been #8283?

Yes, it should be that.

@ghost ghost added the Priority-2 A description (P2) label Jan 4, 2021
@miniksa miniksa added the AutoMerge Marked for automatic merge by the bot when requirements are met label Jan 4, 2021
@ghost
Copy link

ghost commented Jan 4, 2021

Hello @miniksa!

Because this pull request has the AutoMerge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ghost ghost merged commit 5220738 into main Jan 4, 2021
@ghost ghost deleted the dev/miniksa/trace_memory_leak branch January 4, 2021 17:14
@ghost
Copy link

ghost commented Jan 28, 2021

🎉Windows Terminal Preview v1.6.10272.0 has been released which incorporates this pull request.:tada:

Handy links:

mpela81 pushed a commit to mpela81/terminal that referenced this pull request Jan 28, 2021
Fix memory leak that occurs from not dispatching the end of sequences on all actions (since it is buffering up all characters for trace reasons.) Also don't bother storing if no one is listening.

## PR Checklist
- [x] Closes microsoft#8283
* [x] Fixes leak found while bumbling around.
* [x] I work here.

## Detailed Description of the Pull Request / Additional comments
- We trace all the things leading up to the Action phase in the VT parser for ETW tracing to make debugging the parser easier, but we made two mistakes.
- At some point, three of the actions (related to print/execute) weren't dispatching the stored up sequence to tracing and not clearing it. So printing/executing in a giant run over and over caused the vector to bloat and bloat and bloat forever.
- We're storing things even when no one is listening. That's a waste.

## Validation Steps Performed
- Watched it grow every time I did `type big.txt` under `taskman.exe`. Then watched it not do that after.
- I did technically WPR it to figure out this was the culprit.
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Performance Performance-related issue AutoMerge Marked for automatic merge by the bot when requirements are met Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-2 A description (P2) Product-Conhost For issues in the Console codebase Product-Conpty For console issues specifically related to conpty Product-Terminal The new Windows Terminal.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Memory leak with several ANSI sequences
4 participants