Repository navigation
perf(terminal): free Kitty image memory a terminal does not draw - #986
Merged
Merged
Conversation
A terminal off screen lets go of its image textures along with its renderer's pixels, and makes them again when shown. The placement buffer (1024 slots, about 48 KB) is allocated on a terminal's first image instead of in every terminal. docs/ceilings.md records that a PNG is still decoded with the terminal locked, and the two ways out.
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.
Follow-up to #985.
onScreenalready released a hidden terminal's renderer pixels (perf(native): release a hidden terminal's renderer images #962), but the Go copies of its Kitty images stayed inkittyImages.texturesuntil it was shown again:Updateonly runs for terminals on screen.Terminal.ReleaseImagesdrops them along witht.r.Release(), and the nextUpdatemakes again the ones it draws.updatereads the graphics generation and allocates them only once it moves from zero; a plain terminal pays the same one cgo read per frame it paid before.docs/ceilings.mdrecords that a PNG is still decoded with the terminal locked (libghostty calls the decoder insidevt_write), about 20 ms for a 1080p image, and the two ways out if a slow window gets reported.Test plan
TestKittyPlacementBufferOnFirstImageandTestKittyReleaseImagesDropsTexturesfail onmainand pass herenative/:gofmt -l .,go vet ./...,go test ./...