Repository navigation
Free a hidden pane's WebGL renderer until it is shown again - #32
Merged
Merged
Conversation
Every open pane kept xterm.js's WebGL renderer, hidden ones too, each with its own context and glyph textures in the WebView2 GPU process. A pane you can't see draws nothing, so it now drops the renderer and falls back to the DOM one until it is shown. TerminalPane posts "gpu" on IsVisibleChanged (another session picked, Settings open, window hidden to the tray), and once on "ready" for a pane that was hidden before its page was up. Measured with idle sessions, private working set of the GPU process: 4 panes 216 -> ~190 MB, 8 panes 381 -> ~281 MB. Switching panes 20 rounds showed no growth, and each pane painted fully 120 ms after being shown.
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 free
to 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.
Clayo uses less memory with several sessions open: a pane you can't see now gives its GPU memory back until you switch to it.
What changes
TerminalPanetells the page when it is shown or hidden: another session picked, Settings open, window hidden to the tray. It also tells it once the page is ready, for a pane that was hidden before then.Measured
Debug builds, idle Claude Code sessions, own WebView2 folder, private working set of the GPU process. This PC has Intel integrated graphics only, so this memory is system RAM.
WEBGL_lose_contextmade no difference, so it isn't used.Testing
dotnet buildanddotnet build -c Releasewith-warnaserrorgive 0 warnings and 0 errors.scripts/checks.ps1passes all 19 checks.