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 leak in buffering text for UIA when unfocused #16251

Merged
merged 4 commits into from
Nov 10, 2023

Conversation

zadjii-msft
Copy link
Member

Notes in #16217 have the investigation.

TL;DR: we'd always buffer text. Even if we're disabled (unfocused). When we're
disabled, we'd never clear the buffered text. Oops.

Closes #16217

Notes in #16217 have the investigation.

TL;DR: we'd always buffer text. Even if we're disabled (unfocused). When we're
disabled, we'd _never_ clear the buffered text. Oops.

Closes #16217
@microsoft-github-policy-service microsoft-github-policy-service bot added Issue-Bug It either shouldn't be doing this or needs an investigation. Area-Accessibility Issues related to accessibility Area-TerminalControl Issues pertaining to the terminal control (input, selection, keybindings, mouse interaction, etc.) Product-Terminal The new Windows Terminal. Severity-Blocking We won't ship a release like this! No-siree. labels Nov 1, 2023
// If we had buffered any text from NotifyNewText, dump it. When we do come
// back around to actually paint, we will just no-op. No sense in keeping
// the data buffered.
_newOutput.clear();
Copy link
Member

Choose a reason for hiding this comment

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

This will not release any memory however. Additionally, it also doesn't clear _queuedOutput. Do we need to do that?

This comment contains one approach to clear the memory in the EndPaint() method: #16209 (comment)
In the Disable() case I'd release the memory whenever, let's say, _newOutput.capacity() >= 4096 or something.

Copy link
Member Author

Choose a reason for hiding this comment

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

Derp yea, we can resize it too.

I didn't think we needed to clear out _queuedOutput, since we might technically be after EndPaint, but in the middle of a Present.

Copy link
Member

Choose a reason for hiding this comment

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

Ah right, good point.

@DHowett DHowett enabled auto-merge (squash) November 10, 2023 00:33
@DHowett DHowett merged commit d14524c into main Nov 10, 2023
17 checks passed
@DHowett DHowett deleted the dev/migrie/b/16217-uia-memory-leak branch November 10, 2023 01:10
DHowett pushed a commit that referenced this pull request Nov 13, 2023
Notes in #16217 have the investigation.

TL;DR: we'd always buffer text. Even if we're disabled (unfocused). When
we're
disabled, we'd _never_ clear the buffered text. Oops.

Closes #16217

(cherry picked from commit d14524c)
Service-Card-Id: 91033137
Service-Version: 1.18
DHowett pushed a commit that referenced this pull request Nov 13, 2023
Notes in #16217 have the investigation.

TL;DR: we'd always buffer text. Even if we're disabled (unfocused). When
we're
disabled, we'd _never_ clear the buffered text. Oops.

Closes #16217

(cherry picked from commit d14524c)
Service-Card-Id: 91033138
Service-Version: 1.19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Accessibility Issues related to accessibility Area-TerminalControl Issues pertaining to the terminal control (input, selection, keybindings, mouse interaction, etc.) Issue-Bug It either shouldn't be doing this or needs an investigation. Product-Terminal The new Windows Terminal. Severity-Blocking We won't ship a release like this! No-siree.
Projects
Development

Successfully merging this pull request may close these issues.

Memory Leak
3 participants